@agentgates/cli 0.67.0 → 0.73.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 (3) hide show
  1. package/README.md +8 -0
  2. package/dist/cli.mjs +873 -396
  3. 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.67.0";
3131
+ CLI_VERSION = "0.73.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
  }
@@ -32211,7 +32211,7 @@ function eventDigestV2(entry, payload) {
32211
32211
  const json2 = `{"name":${JSON.stringify(entry.event)},"payload":"${payload.toString("hex")}","type":${entry.event_type >>> 0}}`;
32212
32212
  return createHash3("sha384").update(json2, "utf8").digest("hex");
32213
32213
  }
32214
- function quotedAppId(eventLogRaw, quoteRtmr3) {
32214
+ function replayLog(eventLogRaw, quoteRtmr3) {
32215
32215
  if (typeof eventLogRaw !== "string" || !eventLogRaw) return { ok: false, reason: "the attestation carried no event log, so the box identity cannot be read" };
32216
32216
  let entries;
32217
32217
  try {
@@ -32245,28 +32245,47 @@ function quotedAppId(eventLogRaw, quoteRtmr3) {
32245
32245
  if (provedByRecompute) replayed = target;
32246
32246
  }
32247
32247
  if (!replayed || replayed !== target) return { ok: false, reason: "the attestation event log does not replay to the quoted RTMR3" };
32248
- const appIdEvent = imr3.find((e) => e.event === "app-id");
32249
- if (!appIdEvent) return { ok: false, reason: "the attestation event log names no app id" };
32250
- const payload = hexToBuffer(appIdEvent.event_payload);
32251
- if (!payload || payload.length === 0) return { ok: false, reason: "the attestation app-id event has no payload" };
32252
- if (!provedByRecompute) {
32253
- const served = appIdEvent.digest.toLowerCase().replace(/^0x/, "");
32254
- if (eventDigestV1(appIdEvent, payload) !== served && eventDigestV2(appIdEvent, payload) !== served) {
32255
- return { ok: false, reason: "the attestation app-id event does not match its own digest" };
32248
+ return { ok: true, value: { imr3, provedByRecompute } };
32249
+ }
32250
+ function eventPayload(log, name) {
32251
+ const entry = log.imr3.find((e) => e.event === name);
32252
+ if (!entry) return { ok: true, value: null };
32253
+ const payload = hexToBuffer(entry.event_payload);
32254
+ if (!payload || payload.length === 0) return { ok: false, reason: `the attestation ${name} event has no payload` };
32255
+ if (!log.provedByRecompute) {
32256
+ const served = entry.digest.toLowerCase().replace(/^0x/, "");
32257
+ if (eventDigestV1(entry, payload) !== served && eventDigestV2(entry, payload) !== served) {
32258
+ return { ok: false, reason: `the attestation ${name} event does not match its own digest` };
32256
32259
  }
32257
32260
  }
32258
32261
  return { ok: true, value: payload.toString("hex") };
32259
32262
  }
32263
+ function quotedEvents(eventLogRaw, quoteRtmr3) {
32264
+ const log = replayLog(eventLogRaw, quoteRtmr3);
32265
+ if (!log.ok) return log;
32266
+ const appId = eventPayload(log.value, "app-id");
32267
+ if (!appId.ok) return appId;
32268
+ if (appId.value === null) return { ok: false, reason: "the attestation event log names no app id" };
32269
+ const composeHash = eventPayload(log.value, "compose-hash");
32270
+ if (!composeHash.ok) return composeHash;
32271
+ return { ok: true, value: { appId: appId.value, composeHash: composeHash.value } };
32272
+ }
32260
32273
  function verifyBoxQuote(input) {
32261
32274
  if (typeof input.quote !== "string" || !input.quote) return { ok: false, reason: "the box published no attestation quote" };
32262
32275
  const pin = input.pinnedAppId.toLowerCase().replace(/^0x/, "");
32263
32276
  if (!/^[0-9a-f]{2,128}$/.test(pin)) return { ok: false, reason: "the pinned box app id is not hex" };
32264
32277
  const quote = verifyTdxQuote(input.quote, input.expectedReportData, input.now);
32265
32278
  if (!quote.ok) return quote;
32266
- const appId = quotedAppId(input.eventLog, quote.value.rtmr3);
32267
- if (!appId.ok) return appId;
32268
- if (appId.value !== pin) return { ok: false, reason: "that attestation is another box's: its app id is not the one this CLI pins" };
32269
- return { ok: true, value: { appId: appId.value, mrtd: quote.value.mrtd } };
32279
+ const events = quotedEvents(input.eventLog, quote.value.rtmr3);
32280
+ if (!events.ok) return events;
32281
+ if (events.value.appId !== pin) return { ok: false, reason: "that attestation is another box's: its app id is not the one this CLI pins" };
32282
+ const composeHash = events.value.composeHash;
32283
+ if (input.approvedComposeHashes) {
32284
+ if (!composeHash) return { ok: false, reason: "the attestation names no compose hash, so the code the box runs is unknown" };
32285
+ const approved = input.approvedComposeHashes.map((h) => h.toLowerCase().replace(/^0x/, ""));
32286
+ if (!approved.includes(composeHash)) return { ok: false, reason: `the box runs code that is not approved (compose ${composeHash.slice(0, 12)}), so nothing is sealed to it` };
32287
+ }
32288
+ return { ok: true, value: { appId: events.value.appId, mrtd: quote.value.mrtd, composeHash } };
32270
32289
  }
32271
32290
  var INTEL_SGX_ROOT_CA_KEY, NO_CHAIN_REASON, TEE_TYPE_TDX, HEADER_BYTES, TD_REPORT_V10_BYTES, TD_REPORT_V15_BYTES, REPORT_DATA_OFFSET_IN_BODY, REPORT_DATA_BYTES, SGX_REPORT_BYTES, QE_REPORT_DATA_OFFSET, ECDSA_SIG_BYTES, ECDSA_PUBKEY_BYTES, CERT_TYPE_PCK_CHAIN, CERT_TYPE_QE_REPORT, DSTACK_RUNTIME_EVENT_TYPE, RTMR_BYTES;
32272
32291
  var init_tdx_attestation = __esm({
@@ -32291,6 +32310,55 @@ var init_tdx_attestation = __esm({
32291
32310
  }
32292
32311
  });
32293
32312
 
32313
+ // src/lib/cvm-approved.ts
32314
+ function parseCvmApproved(raw) {
32315
+ if (!raw || typeof raw !== "object") return null;
32316
+ const doc = raw;
32317
+ if (doc.v !== CVM_APPROVED_VERSION || !Array.isArray(doc.cvms)) return null;
32318
+ const out = [];
32319
+ for (const item of doc.cvms) {
32320
+ const c = item && typeof item === "object" ? item : null;
32321
+ if (!c || typeof c.name !== "string" || typeof c.appId !== "string" || !APP_ID.test(c.appId)) return null;
32322
+ if (!Array.isArray(c.composeHashes) || !c.composeHashes.every((h) => typeof h === "string" && HEX64.test(h))) return null;
32323
+ out.push({ name: c.name, appId: c.appId, composeHashes: c.composeHashes });
32324
+ }
32325
+ return out;
32326
+ }
32327
+ function approvedFor(cvms, appId) {
32328
+ const app = appId.toLowerCase().replace(/^0x/, "");
32329
+ return cvms.find((c) => c.appId === app)?.composeHashes ?? [];
32330
+ }
32331
+ async function approvedComposeHashes(appId, origin, fetchImpl = fetch) {
32332
+ if (cached && cached.origin === origin && Date.now() - cached.at < CACHE_MS) return approvedFor(cached.cvms, appId);
32333
+ let body;
32334
+ try {
32335
+ const init2 = { headers: { accept: "application/json" }, cache: "no-store", signal: AbortSignal.timeout(2e4) };
32336
+ const res = await fetchImpl(`${origin}/api/public/cvm-approved`, init2);
32337
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
32338
+ body = await res.json();
32339
+ } catch (err) {
32340
+ throw new ApprovedListError(`the approved CVM list at ${origin} did not answer (${err.message}), so nothing was sealed`);
32341
+ }
32342
+ const cvms = parseCvmApproved(body);
32343
+ if (!cvms) throw new ApprovedListError(`the approved CVM list at ${origin} is not the shape this CLI reads, so nothing was sealed`);
32344
+ cached = { origin, at: Date.now(), cvms };
32345
+ return approvedFor(cvms, appId);
32346
+ }
32347
+ var CVM_APPROVED_VERSION, HEX64, APP_ID, cached, CACHE_MS, ApprovedListError;
32348
+ var init_cvm_approved = __esm({
32349
+ "src/lib/cvm-approved.ts"() {
32350
+ "use strict";
32351
+ CVM_APPROVED_VERSION = 1;
32352
+ HEX64 = /^[0-9a-f]{64}$/;
32353
+ APP_ID = /^[0-9a-f]{40}$/;
32354
+ cached = null;
32355
+ CACHE_MS = 6e4;
32356
+ ApprovedListError = class extends Error {
32357
+ code = "approved_list_unreachable";
32358
+ };
32359
+ }
32360
+ });
32361
+
32294
32362
  // src/lib/passwords-wire.ts
32295
32363
  var passwords_wire_exports = {};
32296
32364
  __export(passwords_wire_exports, {
@@ -32320,6 +32388,7 @@ __export(passwords_wire_exports, {
32320
32388
  readSolveChecks: () => readSolveChecks,
32321
32389
  revealRow: () => revealRow,
32322
32390
  revokeLoginKey: () => revokeLoginKey,
32391
+ rowForWorkflow: () => rowForWorkflow,
32323
32392
  runsOnKeyOnly: () => runsOnKeyOnly,
32324
32393
  setKeyMemoryFolders: () => setKeyMemoryFolders,
32325
32394
  setLoginKey: () => setLoginKey,
@@ -32329,6 +32398,7 @@ __export(passwords_wire_exports, {
32329
32398
  updateRow: () => updateRow,
32330
32399
  verifyPasswordsAttestation: () => verifyPasswordsAttestation,
32331
32400
  withdrawInvite: () => withdrawInvite,
32401
+ workflowInputsOf: () => workflowInputsOf,
32332
32402
  writeSolveChecks: () => writeSolveChecks
32333
32403
  });
32334
32404
  import { createHash as createHash4, randomBytes as randomBytes5 } from "node:crypto";
@@ -32464,7 +32534,7 @@ function expectOk(answer, what) {
32464
32534
  const error = typeof b2.error === "string" ? b2.error : `${what}: HTTP ${answer.status}`;
32465
32535
  throw new WireError(answer.status, code, error, answer.body);
32466
32536
  }
32467
- function verifyPasswordsAttestation(body, opts = {}) {
32537
+ function verifyPasswordsAttestation(body, opts) {
32468
32538
  const p = body && typeof body === "object" ? body : null;
32469
32539
  if (!p) return { ok: false, reason: "the box did not answer with an attestation" };
32470
32540
  if (p.v !== PASSWORDS_WIRE_VERSION || p.suite !== PASSWORDS_SUITE) return { ok: false, reason: "this box speaks a different passwords wire" };
@@ -32477,6 +32547,7 @@ function verifyPasswordsAttestation(body, opts = {}) {
32477
32547
  eventLog: p.eventLog,
32478
32548
  expectedReportData,
32479
32549
  pinnedAppId: opts.pinnedAppId ?? PASSWORDS_BOX_APP_ID,
32550
+ approvedComposeHashes: opts.approved,
32480
32551
  now: opts.now
32481
32552
  });
32482
32553
  if (!proof.ok) return proof;
@@ -32499,12 +32570,36 @@ async function readAttestation() {
32499
32570
  const error = body?.error ?? `the CVM's key could not be read: HTTP ${res.status}`;
32500
32571
  throw new WireError(res.status, body?.code ?? null, error, body);
32501
32572
  }
32502
- const proven = verifyPasswordsAttestation(body);
32573
+ let approved;
32574
+ try {
32575
+ approved = await approvedComposeHashes(PASSWORDS_BOX_APP_ID, siteOrigin());
32576
+ } catch (err) {
32577
+ if (err instanceof ApprovedListError) throw new WireError(0, err.code, err.message, null);
32578
+ throw err;
32579
+ }
32580
+ const proven = verifyPasswordsAttestation(body, { approved });
32503
32581
  if (!proven.ok) {
32504
32582
  throw new WireError(0, "box_unproven", `the passwords box did not prove itself (${proven.reason}), so nothing was sealed`, null);
32505
32583
  }
32506
32584
  return proven.value;
32507
32585
  }
32586
+ async function rowForWorkflow(wallet, name) {
32587
+ const { passwords: passwords2, permitted } = await listRows(wallet);
32588
+ const wanted = name.replace(/\s+/g, " ").trim();
32589
+ const hits = [...passwords2, ...permitted].flatMap((r) => (r.workflows ?? []).filter((w) => w.name === wanted).map((workflow) => ({ id: r.id, workflow })));
32590
+ if (hits.length === 0) throw new WireError(404, "workflow_not_found", `no login this key holds or may use has a workflow named "${wanted}"; agentgates passwords list shows them`, null);
32591
+ if (hits.length > 1) throw new WireError(400, "bad_request", `${hits.length} logins have a workflow named "${wanted}"; pass --row <id>`, null);
32592
+ return hits[0];
32593
+ }
32594
+ function workflowInputsOf(pairs) {
32595
+ const out = {};
32596
+ for (const pair of pairs ?? []) {
32597
+ const at = pair.indexOf("=");
32598
+ if (at <= 0) throw new WireError(400, "bad_request", `--input takes name=value (got "${pair.slice(0, 40)}")`, null);
32599
+ out[pair.slice(0, at).trim()] = pair.slice(at + 1);
32600
+ }
32601
+ return out;
32602
+ }
32508
32603
  async function listRows(wallet) {
32509
32604
  const out = expectOk(await signedFetch(wallet, "GET", lanePath(`/passwords`)), "list");
32510
32605
  return { passwords: out.passwords ?? [], permitted: out.permitted ?? [] };
@@ -32560,9 +32655,10 @@ var init_passwords_wire = __esm({
32560
32655
  init_constants();
32561
32656
  init_passwords_seal();
32562
32657
  init_tdx_attestation();
32658
+ init_cvm_approved();
32563
32659
  trim2 = (v) => v ? v.replace(/\/$/, "") : "";
32564
32660
  ACCOUNT_HEADS = { credits: "account/balance", deposit: "account/deposit", plans: "account/plans", keys: "account/keys", docs: "account/docs", catalog: "account/catalog", notify: "account/notify", founder: "account/founder", renew: "account/renew", "seal-key": "account/seal-key", "seal-grants": "account/seal-grants" };
32565
- SERVICE_HEADS = /* @__PURE__ */ new Set(["booth", "booths", "browser", "passwords", "phones", "inboxes", "calls", "personas", "playbooks", "intents", "memory", "ag"]);
32661
+ SERVICE_HEADS = /* @__PURE__ */ new Set(["booth", "booths", "browser", "passwords", "phones", "inboxes", "calls", "personas", "playbooks", "intents", "memory", "ag", "integrations", "sites"]);
32566
32662
  PASSWORDS_USE_PINNED_BY_BOX = false;
32567
32663
  WireError = class extends Error {
32568
32664
  constructor(status4, code, message, body) {
@@ -32582,7 +32678,7 @@ var init_passwords_wire = __esm({
32582
32678
  revokedNoticed = false;
32583
32679
  keyOnly = false;
32584
32680
  loginReading = null;
32585
- SIGNED_DOORS = /\/keys(\/(?!me\/)|$)|\/passwords\/[A-Za-z0-9_-]{1,64}\/use$|\/seal-key$|\/ag\/(?:agent|bindings)$/;
32681
+ SIGNED_DOORS = /\/keys(\/(?!me\/)|$)|\/passwords\/[A-Za-z0-9_-]{1,64}\/use$|\/seal-key$|\/ag\/(?:agent|bindings)$|\/integrations(\/|$)/;
32586
32682
  PASSWORDS_BOX_APP_ID = "c8746c93771d337af3588872dcad76ddb1fccdb6";
32587
32683
  PASSWORDS_REPORT_DATA_LABEL = "agentgates/passwords/seal-key/v1";
32588
32684
  }
@@ -32593,7 +32689,7 @@ var require_package = __commonJS({
32593
32689
  "package.json"(exports, module) {
32594
32690
  module.exports = {
32595
32691
  name: "@agentgates/cli",
32596
- version: "0.67.0",
32692
+ version: "0.73.0",
32597
32693
  description: "Wallet operations for AI agents and humans",
32598
32694
  keywords: [
32599
32695
  "crypto",
@@ -43120,7 +43216,7 @@ var require_dist = __commonJS({
43120
43216
  "use strict";
43121
43217
  class StructError extends TypeError {
43122
43218
  constructor(failure, failures) {
43123
- let cached;
43219
+ let cached2;
43124
43220
  const { message, explanation, ...rest } = failure;
43125
43221
  const { path: path8 } = failure;
43126
43222
  const msg = path8.length === 0 ? message : `At path: ${path8.join(".")} -- ${message}`;
@@ -43130,7 +43226,7 @@ var require_dist = __commonJS({
43130
43226
  Object.assign(this, rest);
43131
43227
  this.name = this.constructor.name;
43132
43228
  this.failures = () => {
43133
- return cached ?? (cached = [failure, ...failures()]);
43229
+ return cached2 ?? (cached2 = [failure, ...failures()]);
43134
43230
  };
43135
43231
  }
43136
43232
  }
@@ -51178,7 +51274,7 @@ var require_eventemitter3 = __commonJS({
51178
51274
  if (listeners.fn) return 1;
51179
51275
  return listeners.length;
51180
51276
  };
51181
- EventEmitter.prototype.emit = function emit11(event, a1, a2, a3, a4, a5) {
51277
+ EventEmitter.prototype.emit = function emit12(event, a1, a2, a3, a4, a5) {
51182
51278
  var evt = prefix ? prefix + event : event;
51183
51279
  if (!this._events[evt]) return false;
51184
51280
  var listeners = this._events[evt], len = arguments.length, args, i;
@@ -56373,7 +56469,7 @@ Message: ${transactionMessage}.
56373
56469
  }
56374
56470
  return signature2;
56375
56471
  }
56376
- function sleep3(ms2) {
56472
+ function sleep4(ms2) {
56377
56473
  return new Promise((resolve3) => setTimeout(resolve3, ms2));
56378
56474
  }
56379
56475
  function encodeData(type, fields) {
@@ -57183,7 +57279,7 @@ Message: ${transactionMessage}.
57183
57279
  }));
57184
57280
  if (connection._rpcEndpoint.includes("solana.com")) {
57185
57281
  const REQUESTS_PER_SECOND = 4;
57186
- await sleep3(1e3 / REQUESTS_PER_SECOND);
57282
+ await sleep4(1e3 / REQUESTS_PER_SECOND);
57187
57283
  }
57188
57284
  offset += chunkSize;
57189
57285
  array = array.slice(chunkSize);
@@ -58338,7 +58434,7 @@ Message: ${transactionMessage}.
58338
58434
  break;
58339
58435
  }
58340
58436
  console.error(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`);
58341
- await sleep3(waitTime);
58437
+ await sleep4(waitTime);
58342
58438
  waitTime *= 2;
58343
58439
  }
58344
58440
  const text = await res.text();
@@ -59453,7 +59549,7 @@ Message: ${transactionMessage}.
59453
59549
  let currentBlockHeight = await checkBlockHeight();
59454
59550
  if (done) return;
59455
59551
  while (currentBlockHeight <= lastValidBlockHeight) {
59456
- await sleep3(1e3);
59552
+ await sleep4(1e3);
59457
59553
  if (done) return;
59458
59554
  currentBlockHeight = await checkBlockHeight();
59459
59555
  if (done) return;
@@ -59525,7 +59621,7 @@ Message: ${transactionMessage}.
59525
59621
  });
59526
59622
  return;
59527
59623
  }
59528
- await sleep3(2e3);
59624
+ await sleep4(2e3);
59529
59625
  if (done) return;
59530
59626
  currentNonceValue = await getCurrentNonceValue();
59531
59627
  if (done) return;
@@ -59553,7 +59649,7 @@ Message: ${transactionMessage}.
59553
59649
  break;
59554
59650
  }
59555
59651
  if (status4.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {
59556
- await sleep3(400);
59652
+ await sleep4(400);
59557
59653
  continue;
59558
59654
  }
59559
59655
  signatureStatus = status4;
@@ -60625,7 +60721,7 @@ Message: ${transactionMessage}.
60625
60721
  async _blockhashWithExpiryBlockHeight(disableCache) {
60626
60722
  if (!disableCache) {
60627
60723
  while (this._pollingBlockhash) {
60628
- await sleep3(100);
60724
+ await sleep4(100);
60629
60725
  }
60630
60726
  const timeSinceFetch = Date.now() - this._blockhashInfo.lastFetch;
60631
60727
  const expired = timeSinceFetch >= BLOCKHASH_CACHE_TIMEOUT_MS;
@@ -60655,7 +60751,7 @@ Message: ${transactionMessage}.
60655
60751
  };
60656
60752
  return latestBlockhash;
60657
60753
  }
60658
- await sleep3(MS_PER_SLOT / 2);
60754
+ await sleep4(MS_PER_SLOT / 2);
60659
60755
  }
60660
60756
  throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`);
60661
60757
  } finally {
@@ -63594,7 +63690,7 @@ var {
63594
63690
  } = import_index.default;
63595
63691
 
63596
63692
  // src/main.ts
63597
- var import_picocolors38 = __toESM(require_picocolors(), 1);
63693
+ var import_picocolors39 = __toESM(require_picocolors(), 1);
63598
63694
 
63599
63695
  // src/commands/login.ts
63600
63696
  var import_picocolors2 = __toESM(require_picocolors(), 1);
@@ -70309,11 +70405,11 @@ async function serveWordsOnce(args) {
70309
70405
  let port = 0;
70310
70406
  let done = () => {
70311
70407
  };
70312
- let fail9 = () => {
70408
+ let fail10 = () => {
70313
70409
  };
70314
70410
  const settled = new Promise((resolve3, reject) => {
70315
70411
  done = resolve3;
70316
- fail9 = reject;
70412
+ fail10 = reject;
70317
70413
  });
70318
70414
  const server = createServer((req, res) => {
70319
70415
  const url = new URL(req.url ?? "/", "http://127.0.0.1");
@@ -70339,7 +70435,7 @@ async function serveWordsOnce(args) {
70339
70435
  const timer = setTimeout(() => {
70340
70436
  if (!taken) {
70341
70437
  server.close();
70342
- fail9(new Error(`nobody took the session in ${Math.round(args.waitMs / 1e3)}s`));
70438
+ fail10(new Error(`nobody took the session in ${Math.round(args.waitMs / 1e3)}s`));
70343
70439
  }
70344
70440
  }, args.waitMs);
70345
70441
  try {
@@ -70353,11 +70449,11 @@ async function receiveKeyOnce(args) {
70353
70449
  let taken = false;
70354
70450
  let done = () => {
70355
70451
  };
70356
- let fail9 = () => {
70452
+ let fail10 = () => {
70357
70453
  };
70358
70454
  const settled = new Promise((resolve3, reject) => {
70359
70455
  done = resolve3;
70360
- fail9 = reject;
70456
+ fail10 = reject;
70361
70457
  });
70362
70458
  const server = createServer(async (req, res) => {
70363
70459
  const url = new URL(req.url ?? "/", "http://127.0.0.1");
@@ -70387,7 +70483,7 @@ async function receiveKeyOnce(args) {
70387
70483
  const timer = setTimeout(() => {
70388
70484
  if (!taken) {
70389
70485
  server.close();
70390
- fail9(new Error(`nobody handed a session over in ${Math.round(args.waitMs / 1e3)}s`));
70486
+ fail10(new Error(`nobody handed a session over in ${Math.round(args.waitMs / 1e3)}s`));
70391
70487
  }
70392
70488
  }, args.waitMs);
70393
70489
  try {
@@ -70909,17 +71005,30 @@ async function passwordsList(opts) {
70909
71005
  `);
70910
71006
  return;
70911
71007
  }
71008
+ const flows = (list) => {
71009
+ for (const w of list ?? []) {
71010
+ const takes = w.inputs.length ? ` --input ${w.inputs.map((i) => `${i.name}=\u2026`).join(" --input ")}` : "";
71011
+ process.stdout.write(` ${"".padEnd(40)} ${import_picocolors9.default.dim("workflow")} ${w.name}${import_picocolors9.default.dim(` ${w.steps} steps${takes}`)}
71012
+ `);
71013
+ }
71014
+ };
70912
71015
  if (passwords2.length) {
70913
71016
  process.stdout.write(` ${import_picocolors9.default.dim("yours")}
70914
71017
  `);
70915
- 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)") : ""}
71018
+ for (const r of passwords2) {
71019
+ 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)") : ""}
70916
71020
  `);
71021
+ flows(r.workflows);
71022
+ }
70917
71023
  }
70918
71024
  if (permitted.length) {
70919
71025
  process.stdout.write(` ${import_picocolors9.default.dim("permitted to you")}
70920
71026
  `);
70921
- 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(", ")}`)}
71027
+ for (const r of permitted) {
71028
+ 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(", ")}`)}
70922
71029
  `);
71030
+ flows(r.workflows);
71031
+ }
70923
71032
  }
70924
71033
  process.stdout.write("\n");
70925
71034
  });
@@ -71003,6 +71112,12 @@ function printUseAnswer(opts, status4, body) {
71003
71112
  const check = result.check && typeof result.check === "object" ? result.check : null;
71004
71113
  if (check && check.passable === true && check.tried !== true) {
71005
71114
  process.stdout.write(` ${import_picocolors9.default.dim(`a ${String(check.kind)} check stood in front of the site; with your own key, --solve lets the CVM pass it (agentgates passwords checks solve: every time)`)}
71115
+ `);
71116
+ }
71117
+ const wf = result.workflow && typeof result.workflow === "object" ? result.workflow : null;
71118
+ if (wf) {
71119
+ const mended = Array.isArray(wf.mended) ? wf.mended.length : 0;
71120
+ process.stdout.write(` ${import_picocolors9.default.dim(`workflow "${String(wf.name)}": ${String(wf.ran)} of ${String(wf.of)} steps${mended ? `, ${mended} found another way and kept` : ""}`)}
71006
71121
  `);
71007
71122
  }
71008
71123
  if (typeof result.error === "string" && result.error) process.stdout.write(` ${result.error}
@@ -71069,8 +71184,19 @@ async function passwordsUse(opts) {
71069
71184
  if (use !== "login" && use !== "session") throw new PasswordsSealError("--mailbox goes with the login or session use");
71070
71185
  request.mailbox = opts.mailbox;
71071
71186
  }
71072
- if (use !== "totp" && use !== "reveal" && typeof request.url !== "string") throw new PasswordsSealError("--url is the https URL the use targets");
71073
- const rowId = opts.row ?? await rowForUrl(wallet, request.url);
71187
+ let workflowRow = null;
71188
+ if (opts.workflow) {
71189
+ if (use !== "login") throw new PasswordsSealError("--workflow goes with the login use");
71190
+ if (opts.stepsJson) throw new PasswordsSealError("--workflow runs the owner's steps; --steps-json is for your own");
71191
+ request.workflow = opts.workflow;
71192
+ const inputs = workflowInputsOf(opts.input);
71193
+ if (Object.keys(inputs).length) request.inputs = inputs;
71194
+ if (!opts.row) workflowRow = (await rowForWorkflow(wallet, opts.workflow)).id;
71195
+ } else if (opts.input?.length) {
71196
+ throw new PasswordsSealError("--input goes with --workflow");
71197
+ }
71198
+ if (use !== "totp" && use !== "reveal" && !opts.workflow && typeof request.url !== "string") throw new PasswordsSealError("--url is the https URL the use targets");
71199
+ const rowId = opts.row ?? workflowRow ?? await rowForUrl(wallet, request.url);
71074
71200
  if (opts.solve && use !== "login" && use !== "session") throw new PasswordsSealError("--solve goes with the login or session use");
71075
71201
  const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...opts.useId ? { useId: opts.useId } : {}, ...opts.solve ? { solve: true } : {} };
71076
71202
  const answer = await postUseAndWait(wallet, rowId, firstBody, waitOptionsOf(opts));
@@ -74801,6 +74927,8 @@ function mcpTools() {
74801
74927
  row: { type: "string", description: "the row id (passwords_list); default: the row whose hosts cover the url" },
74802
74928
  use: { type: "string", enum: [...USE_KINDS], description: "default login" },
74803
74929
  steps: { type: "array", description: "steps at the site after the sign-in (the lane's steps shape), for the login use" },
74930
+ workflow: { type: "string", description: "login only: a workflow the owner taught the VM on the row, by its name (passwords_list shows each row's workflows and the values they take); url may be left out" },
74931
+ inputs: { type: "object", additionalProperties: { type: "string" }, description: "the workflow's values by its own names; a value left out types what the owner typed" },
74804
74932
  codeSteps: { type: "array", description: "steps to the page where the site's code is typed, for the login use" },
74805
74933
  mailbox: { type: "string", description: "the mailbox row the sign-in code is read from, when the account has several" },
74806
74934
  solve: { type: "boolean", description: "login and session, the owner's own key: the VM passes a bot check it meets (Cloudflare, Turnstile, reCAPTCHA, hCaptcha). Under another owner's permit the use parks as check_pending and the owner answers on their board" },
@@ -74826,8 +74954,17 @@ function mcpTools() {
74826
74954
  if (use !== "login" && use !== "session") throw new McpToolError("mailbox goes with the login or session use");
74827
74955
  request.mailbox = mailbox;
74828
74956
  }
74829
- if (use !== "totp" && use !== "reveal" && !url) throw new McpToolError("url is the https URL the use targets");
74830
- const rowId = str(args, "row") ?? await rowForUrl(wallet, url);
74957
+ const workflow = str(args, "workflow");
74958
+ let workflowRow = null;
74959
+ if (workflow) {
74960
+ if (use !== "login") throw new McpToolError("workflow goes with the login use");
74961
+ if (Array.isArray(args.steps)) throw new McpToolError("workflow runs the owner's steps; steps are for your own");
74962
+ request.workflow = workflow;
74963
+ if (args.inputs && typeof args.inputs === "object" && !Array.isArray(args.inputs)) request.inputs = args.inputs;
74964
+ if (!str(args, "row")) workflowRow = (await rowForWorkflow(wallet, workflow)).id;
74965
+ }
74966
+ if (use !== "totp" && use !== "reveal" && !url && !workflow) throw new McpToolError("url is the https URL the use targets");
74967
+ const rowId = str(args, "row") ?? workflowRow ?? await rowForUrl(wallet, url);
74831
74968
  const useId = str(args, "useId");
74832
74969
  if (args.solve === true && use !== "login" && use !== "session") throw new McpToolError("solve goes with the login or session use");
74833
74970
  const firstBody = { use, request: use === "totp" && Object.keys(request).length === 0 ? void 0 : request, ...useId ? { useId } : {}, ...args.solve === true ? { solve: true } : {} };
@@ -76035,9 +76172,310 @@ async function intentsNoShow(askId, opts) {
76035
76172
  }
76036
76173
  }
76037
76174
 
76175
+ // src/commands/integrations.ts
76176
+ var import_picocolors18 = __toESM(require_picocolors(), 1);
76177
+ init_passwords_wire();
76178
+ function emit10(opts, data4, human) {
76179
+ if (opts.json || !process.stdout.isTTY) {
76180
+ process.stdout.write(`${JSON.stringify(data4)}
76181
+ `);
76182
+ return;
76183
+ }
76184
+ human();
76185
+ }
76186
+ function fail6(opts, err) {
76187
+ const message = err instanceof Error ? err.message : String(err);
76188
+ const code = err instanceof WireError ? err.code : err?.code;
76189
+ if (opts.json || !process.stdout.isTTY) {
76190
+ process.stdout.write(`${JSON.stringify({ ok: false, error: message, ...typeof code === "string" ? { code } : {} })}
76191
+ `);
76192
+ } else {
76193
+ process.stderr.write(`
76194
+ ${import_picocolors18.default.red("\u2717")} ${message}
76195
+
76196
+ `);
76197
+ }
76198
+ process.exit(1);
76199
+ }
76200
+ var normalizeOwner2 = (owner) => /^0x[0-9a-fA-F]{40}$/.test(owner.trim()) ? owner.trim().toLowerCase() : owner.trim();
76201
+ function answerAad(owner, integrationId, kind) {
76202
+ return `AGENTGATES-INTEGRATION-v1|${kind}|${normalizeOwner2(owner)}|${integrationId}`;
76203
+ }
76204
+ var REGISTRATIONS = { github: "agentgates", vercel: "agentgates", neon: "api-key" };
76205
+ var isRegistration = (r) => REGISTRATIONS[r.provider] === r.app;
76206
+ function labelAad(owner, r) {
76207
+ return isRegistration(r) ? `AGENTGATES-INTEGRATION-v1|label|${normalizeOwner2(owner)}|${r.id}` : memoryLabelAad(owner, r.id);
76208
+ }
76209
+ var PROVIDER_NAMES = { github: "GitHub", vercel: "Vercel", neon: "Neon", "google-drive": "Google Drive", dropbox: "Dropbox", passwords: "Passwords" };
76210
+ function usedFor(r) {
76211
+ if (r.provider === "passwords") return r.hosts?.[0] ?? "";
76212
+ if (isRegistration(r)) return r.provider === "github" ? "edit access" : r.provider === "vercel" ? "your projects" : "your databases";
76213
+ return `${r.folders ?? 0} ${r.provider === "github" ? "repos" : "folders"} in Memory`;
76214
+ }
76215
+ async function integrationsList(opts) {
76216
+ try {
76217
+ const { wallet } = await requirePasswordsKey();
76218
+ const out = expectOk(await signedFetch(wallet, "GET", lanePath("/integrations")), "integrations");
76219
+ const key = await mailKeyFor(wallet).catch(() => null);
76220
+ const rows = (out.integrations ?? []).map((r) => {
76221
+ let label = r.name;
76222
+ if (!label && key && r.labelBlob) {
76223
+ try {
76224
+ label = openText(key.dataKey, r.labelBlob, labelAad(wallet.address, r));
76225
+ } catch {
76226
+ label = null;
76227
+ }
76228
+ }
76229
+ return { id: r.id, provider: r.provider, app: r.app, state: r.state, label, hosts: r.hosts, folders: r.folders };
76230
+ });
76231
+ emit10(opts, { ok: true, integrations: rows }, () => {
76232
+ if (rows.length === 0) {
76233
+ process.stdout.write(`
76234
+ Nothing connected. Connect on ${import_picocolors18.default.cyan("agentgates.ai/dashboard/user/integrations")}.
76235
+
76236
+ `);
76237
+ return;
76238
+ }
76239
+ process.stdout.write("\n");
76240
+ for (const r of rows) {
76241
+ const what = usedFor(r);
76242
+ process.stdout.write(` ${import_picocolors18.default.bold(PROVIDER_NAMES[r.provider] ?? r.provider)} ${r.label ?? ""} ${import_picocolors18.default.dim(r.state)} ${import_picocolors18.default.dim(what)}
76243
+ ${import_picocolors18.default.dim(r.id)}
76244
+
76245
+ `);
76246
+ }
76247
+ });
76248
+ } catch (err) {
76249
+ fail6(opts, err);
76250
+ }
76251
+ }
76252
+ var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
76253
+ async function integrationsUse(integrationId, opts) {
76254
+ try {
76255
+ if (!/^[A-Za-z0-9_-]{1,64}$/.test(integrationId)) throw new Error("an integration id is 1 to 64 of A-Z a-z 0-9 _ -");
76256
+ const { wallet } = await requirePasswordsKey();
76257
+ const sealing = sealingKeyFromSignature(await wallet.signMessage(MAIL_SEAL_MESSAGE_V1));
76258
+ const door = opts.file ? "file" : "list";
76259
+ const waitMs = Math.max(0, Math.min(900, Number(opts.wait ?? "300"))) * 1e3;
76260
+ const deadline = Date.now() + waitMs;
76261
+ let useId = null;
76262
+ let told = false;
76263
+ for (; ; ) {
76264
+ const q = new URLSearchParams(door === "file" ? { fileId: opts.file } : { what: "folder", ...opts.folder ? { folderId: opts.folder } : {} });
76265
+ q.set("recipient", sealing.publicKey);
76266
+ if (useId) q.set("use", useId);
76267
+ const answer = await signedFetch(wallet, "GET", lanePath(`/integrations/${integrationId}/${door}?${q.toString()}`));
76268
+ if (answer.status === 202) {
76269
+ const use = answer.body?.use ?? {};
76270
+ useId = typeof use.id === "string" ? use.id : useId;
76271
+ if (!told && !(opts.json || !process.stdout.isTTY)) {
76272
+ process.stdout.write(`
76273
+ ${import_picocolors18.default.yellow("\u2026")} waiting for the owner to allow this read on their board
76274
+ `);
76275
+ told = true;
76276
+ }
76277
+ if (Date.now() >= deadline) {
76278
+ emit10(opts, { ok: false, code: "approval_pending", use: answer.body?.use ?? null }, () => process.stdout.write(` still waiting; run it again with the same arguments to keep waiting
76279
+
76280
+ `));
76281
+ process.exit(2);
76282
+ }
76283
+ await sleep2(3e3);
76284
+ continue;
76285
+ }
76286
+ const body = expectOk(answer, `integration ${door}`);
76287
+ const owner = typeof body.owner === "string" ? body.owner : "";
76288
+ if (door === "file") {
76289
+ const file = JSON.parse(openText(sealing.secret, String(body.fileBlob), answerAad(owner, integrationId, "file-answer")));
76290
+ emit10(opts, { ok: true, name: file.name, text: file.text }, () => process.stdout.write(`${file.text}${file.text.endsWith("\n") ? "" : "\n"}`));
76291
+ return;
76292
+ }
76293
+ const listing = JSON.parse(openText(sealing.secret, String(body.listBlob), answerAad(owner, integrationId, "list-answer")));
76294
+ emit10(opts, { ok: true, ...listing.what ? { what: listing.what } : {}, entries: listing.entries }, () => {
76295
+ process.stdout.write("\n");
76296
+ if (listing.entries.length === 0) process.stdout.write(` ${import_picocolors18.default.dim(listing.what === "projects" ? "no projects this connection reaches" : "nothing here that the owner picked")}
76297
+ `);
76298
+ for (const e of listing.entries) {
76299
+ if (listing.what === "projects") process.stdout.write(` ${import_picocolors18.default.bold(e.name)} ${import_picocolors18.default.dim(e.repo?.fullName ?? e.url ?? "")} ${import_picocolors18.default.dim(e.id)}
76300
+ `);
76301
+ else process.stdout.write(` ${e.kind === "folder" ? import_picocolors18.default.cyan(`${e.name}/`) : e.name} ${import_picocolors18.default.dim(e.id)}
76302
+ `);
76303
+ }
76304
+ process.stdout.write("\n");
76305
+ });
76306
+ return;
76307
+ }
76308
+ } catch (err) {
76309
+ fail6(opts, err);
76310
+ }
76311
+ }
76312
+ async function integrationsSignup(provider, opts) {
76313
+ try {
76314
+ const { wallet } = await requirePasswordsKey();
76315
+ const id2 = Buffer.from(crypto.getRandomValues(new Uint8Array(16))).toString("base64url");
76316
+ const answer = await signedFetch(wallet, "POST", lanePath("/integrations/signup"), { id: id2, provider, ...opts.inbox ? { inboxId: opts.inbox } : {} });
76317
+ if (answer.status !== 202) expectOk(answer, "integrations signup");
76318
+ const r = answer.body?.integration;
76319
+ const facts = answer.body?.signup;
76320
+ emit10(opts, { ok: true, id: r?.id, signupId: facts?.source?.id ?? null, inbox: facts?.source?.address ?? null, provider, state: r?.state }, () => {
76321
+ process.stdout.write(`
76322
+ ${import_picocolors18.default.bold(PROVIDER_NAMES[provider] ?? provider)} account signup opened: ${import_picocolors18.default.dim(r?.id ?? "")}
76323
+ Inbox: ${import_picocolors18.default.cyan(facts?.source?.address ?? "?")}
76324
+
76325
+ `);
76326
+ });
76327
+ } catch (err) {
76328
+ fail6(opts, err);
76329
+ }
76330
+ }
76331
+ async function integrationsSignupReport(signupId, opts) {
76332
+ try {
76333
+ const { wallet } = await requirePasswordsKey();
76334
+ const answer = await signedFetch(wallet, "POST", lanePath(`/integrations/signup/${encodeURIComponent(signupId)}/report`), { loginId: opts.loginId });
76335
+ expectOk(answer, "integrations signup report");
76336
+ emit10(opts, { ok: true, id: answer.body?.integration?.id, loginId: opts.loginId ?? null }, () => {
76337
+ process.stdout.write(`
76338
+ Reported.${opts.loginId ? ` Login row: ${import_picocolors18.default.dim(opts.loginId)}.` : ""}
76339
+
76340
+ `);
76341
+ });
76342
+ } catch (err) {
76343
+ fail6(opts, err);
76344
+ }
76345
+ }
76346
+ async function integrationsSignupHandoff(signupId, provider, opts) {
76347
+ try {
76348
+ const { wallet } = await requirePasswordsKey();
76349
+ const body = { provider };
76350
+ if (opts.code) body.code = opts.code;
76351
+ if (opts.installationId) body.installationId = opts.installationId;
76352
+ if (opts.setupAction) body.setupAction = opts.setupAction;
76353
+ if (opts.configurationId) body.configurationId = opts.configurationId;
76354
+ if (opts.teamId) body.teamId = opts.teamId;
76355
+ if (opts.redirectUri) body.redirectUri = opts.redirectUri;
76356
+ if (opts.sealed) body.sealed = JSON.parse(await (await import("node:fs/promises")).readFile(opts.sealed, "utf8"));
76357
+ else if (opts.grantCvm && opts.cvmKeyId) body.sealed = { grantCvm: opts.grantCvm, cvmKeyId: opts.cvmKeyId };
76358
+ const answer = await signedFetch(wallet, "POST", lanePath(`/integrations/signup/${encodeURIComponent(signupId)}/handoff`), body);
76359
+ expectOk(answer, "integrations signup handoff");
76360
+ const r = answer.body?.integration;
76361
+ emit10(opts, { ok: true, id: r?.id, state: r?.state, accountId: r ? r.accountId ?? null : null }, () => {
76362
+ process.stdout.write(`
76363
+ Connected: ${import_picocolors18.default.green(r?.state ?? "?")} ${import_picocolors18.default.dim(r?.id ?? "")}
76364
+
76365
+ `);
76366
+ });
76367
+ } catch (err) {
76368
+ fail6(opts, err);
76369
+ }
76370
+ }
76371
+ async function sitesList(opts) {
76372
+ try {
76373
+ const { wallet } = await requirePasswordsKey();
76374
+ const out = expectOk(await signedFetch(wallet, "GET", lanePath("/sites")), "sites");
76375
+ const key = await mailKeyFor(wallet).catch(() => null);
76376
+ const rows = (out.apps ?? []).map((a) => {
76377
+ let label = null;
76378
+ if (key && a.labelBlob) {
76379
+ try {
76380
+ label = JSON.parse(openText(key.dataKey, a.labelBlob, `AGENTGATES-APPS-v1|app-label|${normalizeOwner2(wallet.address)}|${a.id}`));
76381
+ } catch {
76382
+ label = null;
76383
+ }
76384
+ }
76385
+ return { id: a.id, state: a.state, code: a.code, name: label?.name ?? null, repo: label?.repo ?? null, url: label?.url ?? null, vercelProjectId: a.vercelProjectId };
76386
+ });
76387
+ emit10(opts, { ok: true, sites: rows }, () => {
76388
+ if (rows.length === 0) {
76389
+ process.stdout.write(`
76390
+ No site connected. Connect one from Vercel on ${import_picocolors18.default.cyan("agentgates.ai/dashboard/user/integrations")}.
76391
+
76392
+ `);
76393
+ return;
76394
+ }
76395
+ process.stdout.write("\n");
76396
+ for (const r of rows) {
76397
+ const state = r.state === "ready" ? import_picocolors18.default.green("ready") : import_picocolors18.default.yellow(r.code ?? r.state);
76398
+ process.stdout.write(` ${import_picocolors18.default.bold(r.name ?? r.vercelProjectId ?? r.id)} ${state} ${import_picocolors18.default.dim(r.repo ?? "")} ${import_picocolors18.default.dim(r.url ?? "")}
76399
+ ${import_picocolors18.default.dim(r.id)}
76400
+
76401
+ `);
76402
+ }
76403
+ });
76404
+ } catch (err) {
76405
+ fail6(opts, err);
76406
+ }
76407
+ }
76408
+ var CHANGE_ID_RE = /^[A-Za-z0-9_-]{22}$/;
76409
+ function cardAad(owner, card2) {
76410
+ return `AGENTGATES-CONVERSATION-v1|turn|${normalizeOwner2(owner)}|${card2.conversationId}|${card2.seq}|assistant|card|`;
76411
+ }
76412
+ async function sitesChange(changeId, opts) {
76413
+ try {
76414
+ if (!CHANGE_ID_RE.test(changeId)) throw new Error("a change id is 22 characters (the one the card's link ends in)");
76415
+ const { wallet } = await requirePasswordsKey();
76416
+ const out = expectOk(await signedFetch(wallet, "GET", lanePath(`/sites/changes/${changeId}`)), "sites change");
76417
+ const key = await mailKeyFor(wallet).catch(() => null);
76418
+ const latest = [...out.rounds ?? []].reverse().find((r) => r.card) ?? null;
76419
+ let card2 = null;
76420
+ if (key && latest?.card) {
76421
+ try {
76422
+ card2 = JSON.parse(openText(key.dataKey, latest.card.ciphertext, cardAad(wallet.address, latest.card)));
76423
+ } catch {
76424
+ card2 = null;
76425
+ }
76426
+ }
76427
+ const c = out.change;
76428
+ emit10(opts, { ok: true, change: c, rounds: (out.rounds ?? []).map((r) => ({ id: r.id, round: r.round, state: r.state, cardRef: r.cardRef })), card: card2 ? { words: card2.words ?? null } : null }, () => {
76429
+ process.stdout.write(`
76430
+ ${import_picocolors18.default.bold(c.id)} ${c.state === "ready" ? import_picocolors18.default.green("ready") : import_picocolors18.default.yellow(c.state)} ${import_picocolors18.default.dim(`round ${c.round}`)}
76431
+ `);
76432
+ if (card2?.words) process.stdout.write(` ${card2.words}
76433
+ `);
76434
+ if (c.state === "ready") process.stdout.write(` ${import_picocolors18.default.dim(`ship it: agentgates sites ship ${c.id}`)}
76435
+ `);
76436
+ process.stdout.write("\n");
76437
+ });
76438
+ } catch (err) {
76439
+ fail6(opts, err);
76440
+ }
76441
+ }
76442
+ async function sitesShip(changeId, opts) {
76443
+ try {
76444
+ if (!CHANGE_ID_RE.test(changeId)) throw new Error("a change id is 22 characters (the one the card's link ends in)");
76445
+ const { wallet } = await requirePasswordsKey();
76446
+ const read = expectOk(await signedFetch(wallet, "GET", lanePath(`/sites/changes/${changeId}`)), "sites change");
76447
+ const head = read.change?.headSha;
76448
+ if (read.change?.state !== "ready" || !head) throw new Error(`the change is ${read.change?.state ?? "unread"}: only a ready change ships`);
76449
+ const out = expectOk(await signedFetch(wallet, "POST", lanePath(`/sites/changes/${changeId}/ship/${head}`)), "sites ship");
76450
+ emit10(opts, { ok: true, change: out.change }, () => {
76451
+ process.stdout.write(`
76452
+ ${import_picocolors18.default.green(out.change.state)} ${import_picocolors18.default.dim(out.change.id)}
76453
+
76454
+ `);
76455
+ });
76456
+ } catch (err) {
76457
+ fail6(opts, err);
76458
+ }
76459
+ }
76460
+ async function sitesSkip(changeId, opts) {
76461
+ try {
76462
+ if (!CHANGE_ID_RE.test(changeId)) throw new Error("a change id is 22 characters (the one the card's link ends in)");
76463
+ const { wallet } = await requirePasswordsKey();
76464
+ const out = expectOk(await signedFetch(wallet, "POST", lanePath(`/sites/changes/${changeId}/skip`)), "sites skip");
76465
+ emit10(opts, { ok: true, change: out.change }, () => {
76466
+ process.stdout.write(`
76467
+ ${import_picocolors18.default.yellow(out.change.state)} ${import_picocolors18.default.dim(out.change.id)}
76468
+
76469
+ `);
76470
+ });
76471
+ } catch (err) {
76472
+ fail6(opts, err);
76473
+ }
76474
+ }
76475
+
76038
76476
  // src/commands/agent.ts
76039
76477
  init_lib2();
76040
- var import_picocolors18 = __toESM(require_picocolors(), 1);
76478
+ var import_picocolors19 = __toESM(require_picocolors(), 1);
76041
76479
  init_passwords_wire();
76042
76480
 
76043
76481
  // src/lib/ag-wire.ts
@@ -76047,7 +76485,7 @@ import { createHash as createHash6 } from "node:crypto";
76047
76485
  // src/lib/conversation-seal.ts
76048
76486
  var CONVERSATION_SUITE = "AGENTGATES-CONVERSATION-v1";
76049
76487
  var JOURNAL_COPY_SUITE = "AGENTGATES-MEMORY-JOURNAL-v1";
76050
- var CONVERSATION_AUTHORS = ["person", "assistant", "agent", "act"];
76488
+ var CONVERSATION_AUTHORS = ["person", "assistant", "agent", "act", "card"];
76051
76489
  var CONVERSATION_CHANNELS = ["site", "telegram", "whatsapp", "mail", "sms", "voice", "mcp"];
76052
76490
  function isConversationAuthor(value) {
76053
76491
  return typeof value === "string" && CONVERSATION_AUTHORS.includes(value);
@@ -76060,7 +76498,8 @@ function roleOfAuthor(author) {
76060
76498
  }
76061
76499
  function readConversationOrigin(author, channel) {
76062
76500
  if (!isConversationAuthor(author)) return null;
76063
- if (channel === null || channel === void 0 || channel === "") return author === "act" ? { author, channel: null } : null;
76501
+ if (channel === null || channel === void 0 || channel === "") return author === "act" || author === "card" ? { author, channel: null } : null;
76502
+ if (author === "card") return null;
76064
76503
  return isConversationChannel(channel) ? { author, channel } : null;
76065
76504
  }
76066
76505
  function conversationOwner(address) {
@@ -76075,6 +76514,7 @@ function conversationTurnAad(owner, conversationId, seq, role, origin) {
76075
76514
  // src/lib/ag-wire.ts
76076
76515
  init_passwords_wire();
76077
76516
  init_tdx_attestation();
76517
+ init_cvm_approved();
76078
76518
  var AG_SEAL_SUITE = "AGENTGATES-AG-v1";
76079
76519
  var AG_REPORT_DATA_LABEL = "agentgates/ag/fleet-key/v1";
76080
76520
  var AG_JOURNAL_LANE = "agent";
@@ -76121,7 +76561,7 @@ function isLoopbackOrigin(origin) {
76121
76561
  return false;
76122
76562
  }
76123
76563
  }
76124
- function verifyAgFleetAttestation(body, opts = {}) {
76564
+ function verifyAgFleetAttestation(body, opts) {
76125
76565
  const parsed = parseAgAttestation(body);
76126
76566
  if (!parsed.ok) return { ok: false, reason: parsed.error };
76127
76567
  const att = parsed.attestation;
@@ -76134,6 +76574,7 @@ function verifyAgFleetAttestation(body, opts = {}) {
76134
76574
  eventLog: body.eventLog,
76135
76575
  expectedReportData: Buffer.from(fleetBindingReportData(att.publicKey), "hex"),
76136
76576
  pinnedAppId: opts.pinnedAppId ?? AG_FLEET_APP_ID,
76577
+ approvedComposeHashes: opts.approved,
76137
76578
  now: opts.now
76138
76579
  });
76139
76580
  if (!proof.ok) return proof;
@@ -76151,7 +76592,14 @@ async function readAgAttestation() {
76151
76592
  }
76152
76593
  const body = await res.json().catch(() => null);
76153
76594
  if (!res.ok) throw new WireError(res.status, typeof body?.code === "string" ? body.code : null, typeof body?.error === "string" ? body.error : `the attestation door answered ${res.status}`, body);
76154
- const proven = verifyAgFleetAttestation(body);
76595
+ let approved;
76596
+ try {
76597
+ approved = await approvedComposeHashes(AG_FLEET_APP_ID, siteOrigin());
76598
+ } catch (err) {
76599
+ if (err instanceof ApprovedListError) throw new WireError(0, err.code, err.message, null);
76600
+ throw err;
76601
+ }
76602
+ const proven = verifyAgFleetAttestation(body, { approved });
76155
76603
  if (!proven.ok) throw new WireError(0, "box_unproven", `the AG AI box did not prove itself (${proven.reason}), so nothing was sealed`, null);
76156
76604
  return proven.value;
76157
76605
  }
@@ -76221,7 +76669,7 @@ async function revokeBinding(wallet, id2) {
76221
76669
  }
76222
76670
 
76223
76671
  // src/commands/agent.ts
76224
- function emit10(opts, data4, human) {
76672
+ function emit11(opts, data4, human) {
76225
76673
  if (opts.json || !process.stdout.isTTY) {
76226
76674
  process.stdout.write(`${JSON.stringify(data4)}
76227
76675
  `);
@@ -76229,7 +76677,7 @@ function emit10(opts, data4, human) {
76229
76677
  }
76230
76678
  human();
76231
76679
  }
76232
- function fail6(opts, err) {
76680
+ function fail7(opts, err) {
76233
76681
  const message = err instanceof Error ? err.message : String(err);
76234
76682
  const code = err?.code;
76235
76683
  if (opts.json || !process.stdout.isTTY) {
@@ -76237,7 +76685,7 @@ function fail6(opts, err) {
76237
76685
  `);
76238
76686
  } else {
76239
76687
  process.stderr.write(`
76240
- ${import_picocolors18.default.red("\u2717")} ${message}
76688
+ ${import_picocolors19.default.red("\u2717")} ${message}
76241
76689
 
76242
76690
  `);
76243
76691
  }
@@ -76247,10 +76695,10 @@ function short2(address) {
76247
76695
  return `${address.slice(0, 6)}\u2026${address.slice(-4)}`;
76248
76696
  }
76249
76697
  function agentLine(agent2) {
76250
- if (!agent2 || agent2.state !== "on") return import_picocolors18.default.dim("off");
76698
+ if (!agent2 || agent2.state !== "on") return import_picocolors19.default.dim("off");
76251
76699
  const reach = agent2.reach;
76252
76700
  const where = [reach?.number, reach?.address].filter(Boolean).join(" ");
76253
- return `${import_picocolors18.default.bold(short2(agent2.agentAddress))} ${import_picocolors18.default.dim("pays from your balance")}${where ? ` ${import_picocolors18.default.dim(where)}` : ""}`;
76701
+ return `${import_picocolors19.default.bold(short2(agent2.agentAddress))} ${import_picocolors19.default.dim("pays from your balance")}${where ? ` ${import_picocolors19.default.dim(where)}` : ""}`;
76254
76702
  }
76255
76703
  function sendTo(channel, to) {
76256
76704
  const target = channel === "sms" ? to.house?.number ?? to.number : to.address;
@@ -76259,33 +76707,33 @@ function sendTo(channel, to) {
76259
76707
  }
76260
76708
  function bindingLine(b2, to) {
76261
76709
  if (b2.channel === "telegram" || b2.channel === "whatsapp") {
76262
- const state2 = b2.bound ? import_picocolors18.default.green("bound") : b2.expired ? import_picocolors18.default.dim(`the link lapsed: agentgates agent bind ${b2.channel}`) : import_picocolors18.default.dim(`link open until ${(b2.expiresAt ?? "").slice(11, 16)} UTC`);
76263
- return ` ${import_picocolors18.default.dim(b2.id)} ${b2.channel} ${b2.senderId ?? ""} ${state2}`;
76710
+ const state2 = b2.bound ? import_picocolors19.default.green("bound") : b2.expired ? import_picocolors19.default.dim(`the link lapsed: agentgates agent bind ${b2.channel}`) : import_picocolors19.default.dim(`link open until ${(b2.expiresAt ?? "").slice(11, 16)} UTC`);
76711
+ return ` ${import_picocolors19.default.dim(b2.id)} ${b2.channel} ${b2.senderId ?? ""} ${state2}`;
76264
76712
  }
76265
76713
  if (b2.confirm && !b2.bound) {
76266
- const state2 = b2.expired ? import_picocolors18.default.dim(`the link lapsed: agentgates agent bind mail ${b2.senderId}`) : import_picocolors18.default.dim(`check its mail for the link, until ${(b2.expiresAt ?? "").slice(11, 16)} UTC`);
76267
- return ` ${import_picocolors18.default.dim(b2.id)} ${b2.channel} ${b2.senderId} ${state2}`;
76714
+ const state2 = b2.expired ? import_picocolors19.default.dim(`the link lapsed: agentgates agent bind mail ${b2.senderId}`) : import_picocolors19.default.dim(`check its mail for the link, until ${(b2.expiresAt ?? "").slice(11, 16)} UTC`);
76715
+ return ` ${import_picocolors19.default.dim(b2.id)} ${b2.channel} ${b2.senderId} ${state2}`;
76268
76716
  }
76269
- if (b2.bound && b2.channel === "mail" && to.house?.mail) return ` ${import_picocolors18.default.dim(b2.id)} mail ${b2.senderId} ${import_picocolors18.default.green("bound")} ${import_picocolors18.default.dim(`write to ${to.house.mail}`)}`;
76270
- const state = b2.bound ? import_picocolors18.default.green("bound") : b2.code ? `${import_picocolors18.default.bold(b2.code)} ${import_picocolors18.default.dim(sendTo(b2.channel, to))}` : import_picocolors18.default.dim("open");
76271
- return ` ${import_picocolors18.default.dim(b2.id)} ${b2.channel} ${b2.senderId} ${state}`;
76717
+ if (b2.bound && b2.channel === "mail" && to.house?.mail) return ` ${import_picocolors19.default.dim(b2.id)} mail ${b2.senderId} ${import_picocolors19.default.green("bound")} ${import_picocolors19.default.dim(`write to ${to.house.mail}`)}`;
76718
+ const state = b2.bound ? import_picocolors19.default.green("bound") : b2.code ? `${import_picocolors19.default.bold(b2.code)} ${import_picocolors19.default.dim(sendTo(b2.channel, to))}` : import_picocolors19.default.dim("open");
76719
+ return ` ${import_picocolors19.default.dim(b2.id)} ${b2.channel} ${b2.senderId} ${state}`;
76272
76720
  }
76273
76721
  async function agentStatus(opts) {
76274
76722
  try {
76275
76723
  const { wallet } = await requirePasswordsKey();
76276
76724
  const read = await readAgent(wallet);
76277
- emit10(opts, { ok: true, ...read }, () => {
76725
+ emit11(opts, { ok: true, ...read }, () => {
76278
76726
  process.stdout.write(`
76279
76727
  your agent: ${agentLine(read.agent)}
76280
76728
  `);
76281
- if (read.agent?.state === "on") process.stdout.write(` ${import_picocolors18.default.dim(`address ${read.agent.agentAddress}`)}
76729
+ if (read.agent?.state === "on") process.stdout.write(` ${import_picocolors19.default.dim(`address ${read.agent.agentAddress}`)}
76282
76730
  `);
76283
- if (!read.fleet.keyPublished) process.stdout.write(` ${import_picocolors18.default.dim("the AG AI CVM has not published its key on this deployment yet")}
76731
+ if (!read.fleet.keyPublished) process.stdout.write(` ${import_picocolors19.default.dim("the AG AI CVM has not published its key on this deployment yet")}
76284
76732
  `);
76285
76733
  process.stdout.write("\n");
76286
76734
  });
76287
76735
  } catch (err) {
76288
- fail6(opts, err);
76736
+ fail7(opts, err);
76289
76737
  }
76290
76738
  }
76291
76739
  async function agentOn(opts) {
@@ -76310,14 +76758,14 @@ async function agentOn(opts) {
76310
76758
  const memoryKeyBoxBlob = sealText(fleet.publicKey, JSON.stringify({ wire: made.key, reading }), agMemoryKeyAad(wallet.address, made.created.id));
76311
76759
  const out = await postAgentOn(wallet, { agentAddress: agent2.address, keyOwnerBlob, keyBoxBlob, memoryKeyId: made.created.id, memoryKeyBoxBlob });
76312
76760
  const note2 = opts.fund !== void 0 ? AGENT_PAYS_SENTENCE : null;
76313
- emit10(opts, { ok: true, agent: out.agent, memoryKeyId: made.created.id, fleet: { mode: fleet.mode, keyId: fleet.keyId }, ...note2 ? { note: note2 } : {} }, () => {
76761
+ emit11(opts, { ok: true, agent: out.agent, memoryKeyId: made.created.id, fleet: { mode: fleet.mode, keyId: fleet.keyId }, ...note2 ? { note: note2 } : {} }, () => {
76314
76762
  process.stdout.write(
76315
76763
  `
76316
- ${import_picocolors18.default.green("\u2713")} your agent is on: ${import_picocolors18.default.bold(agent2.address)}, paying from your balance
76317
- ${import_picocolors18.default.dim(`its key is sealed to you and to the CVM (${fleet.mode}, key ${fleet.keyId.slice(0, 12)}\u2026); its Memory key is ${made.created.prefix}`)}
76318
- ` + (note2 ? ` ${import_picocolors18.default.dim(note2)}
76319
- ` : "") + ` ${import_picocolors18.default.dim(`agentgates passwords allow --agent ${agent2.address} \u2026 \xB7 lets it use your saved logins`)}
76320
- ${import_picocolors18.default.dim('agentgates agent say "\u2026" \xB7 tells it what to do')}
76764
+ ${import_picocolors19.default.green("\u2713")} your agent is on: ${import_picocolors19.default.bold(agent2.address)}, paying from your balance
76765
+ ${import_picocolors19.default.dim(`its key is sealed to you and to the CVM (${fleet.mode}, key ${fleet.keyId.slice(0, 12)}\u2026); its Memory key is ${made.created.prefix}`)}
76766
+ ` + (note2 ? ` ${import_picocolors19.default.dim(note2)}
76767
+ ` : "") + ` ${import_picocolors19.default.dim(`agentgates passwords allow --agent ${agent2.address} \u2026 \xB7 lets it use your saved logins`)}
76768
+ ${import_picocolors19.default.dim('agentgates agent say "\u2026" \xB7 tells it what to do')}
76321
76769
 
76322
76770
  `
76323
76771
  );
@@ -76327,7 +76775,7 @@ async function agentOn(opts) {
76327
76775
  throw err;
76328
76776
  }
76329
76777
  } catch (err) {
76330
- fail6(opts, err);
76778
+ fail7(opts, err);
76331
76779
  }
76332
76780
  }
76333
76781
  async function agentOff(opts) {
@@ -76342,37 +76790,37 @@ async function agentOff(opts) {
76342
76790
  revokedKey = before.agent.memoryKeyId;
76343
76791
  }).catch(() => void 0);
76344
76792
  }
76345
- emit10(opts, { ok: true, agent: out.agent, sweptBackUsd: out.sweptBackUsd, revokedKey }, () => {
76793
+ emit11(opts, { ok: true, agent: out.agent, sweptBackUsd: out.sweptBackUsd, revokedKey }, () => {
76346
76794
  const swept = Number(out.sweptBackUsd) > 0 ? `$${out.sweptBackUsd} it held came back to your balance` : "";
76347
76795
  const said = [swept, revokedKey ? "its Memory key is revoked" : ""].filter(Boolean).join("; ");
76348
76796
  process.stdout.write(`
76349
- ${import_picocolors18.default.green("\u2713")} your agent is off.${said ? ` ${import_picocolors18.default.dim(`${said}.`)}` : ""}
76350
- ${import_picocolors18.default.dim("agentgates passwords permits \xB7 shows any permit still standing for it")}
76797
+ ${import_picocolors19.default.green("\u2713")} your agent is off.${said ? ` ${import_picocolors19.default.dim(`${said}.`)}` : ""}
76798
+ ${import_picocolors19.default.dim("agentgates passwords permits \xB7 shows any permit still standing for it")}
76351
76799
 
76352
76800
  `);
76353
76801
  });
76354
76802
  } catch (err) {
76355
- fail6(opts, err);
76803
+ fail7(opts, err);
76356
76804
  }
76357
76805
  }
76358
76806
  async function agentFund(_amountUsd, opts) {
76359
- fail6(opts, agentPaysRefusal());
76807
+ fail7(opts, agentPaysRefusal());
76360
76808
  }
76361
76809
  async function agentRefill(_action, opts) {
76362
- fail6(opts, agentPaysRefusal());
76810
+ fail7(opts, agentPaysRefusal());
76363
76811
  }
76364
76812
  async function agentSay(text, opts) {
76365
76813
  try {
76366
76814
  const { wallet } = await requirePasswordsKey();
76367
76815
  const said = await sayToAgent(wallet, text);
76368
- emit10(opts, { ok: true, ...said }, () => {
76816
+ emit11(opts, { ok: true, ...said }, () => {
76369
76817
  process.stdout.write(`
76370
- ${import_picocolors18.default.green("\u2713")} sent${said.woke ? "" : " (the CVM was not woken; the sweep will)"}. ${import_picocolors18.default.dim("agentgates agent journal \xB7 reads the thread")}
76818
+ ${import_picocolors19.default.green("\u2713")} sent${said.woke ? "" : " (the CVM was not woken; the sweep will)"}. ${import_picocolors19.default.dim("agentgates agent journal \xB7 reads the thread")}
76371
76819
 
76372
76820
  `);
76373
76821
  });
76374
76822
  } catch (err) {
76375
- fail6(opts, err);
76823
+ fail7(opts, err);
76376
76824
  }
76377
76825
  }
76378
76826
  async function agentJournal(opts) {
@@ -76383,25 +76831,25 @@ async function agentJournal(opts) {
76383
76831
  const tail = Number.parseInt(opts.tail ?? "40", 10);
76384
76832
  const { owner, conversationId, rows } = await readAgentThread(wallet, Number.isFinite(tail) && tail > 0 ? tail : 40);
76385
76833
  const lines = conversationId ? rows.map((r) => openAgentThreadRow(key.dataKey, owner, conversationId, r)) : [];
76386
- emit10(opts, { ok: true, lane: AG_JOURNAL_LANE, conversationId, lines }, () => {
76834
+ emit11(opts, { ok: true, lane: AG_JOURNAL_LANE, conversationId, lines }, () => {
76387
76835
  if (lines.length === 0) {
76388
76836
  process.stdout.write(`
76389
- ${import_picocolors18.default.dim("nothing in the thread yet")}
76837
+ ${import_picocolors19.default.dim("nothing in the thread yet")}
76390
76838
 
76391
76839
  `);
76392
76840
  return;
76393
76841
  }
76394
76842
  process.stdout.write("\n");
76395
76843
  for (const l of lines) {
76396
- const who = l.who === "agent" ? import_picocolors18.default.bold("agent") : l.who === "act" ? import_picocolors18.default.dim("act") : "you";
76397
- const via = l.channel && l.channel !== "site" && l.who !== "act" ? import_picocolors18.default.dim(` (${l.channel})`) : "";
76398
- process.stdout.write(` ${import_picocolors18.default.dim(l.at.slice(11, 16))} ${who}${via} ${l.words ?? import_picocolors18.default.dim("(does not open with this key)")}
76844
+ const who = l.who === "agent" ? import_picocolors19.default.bold("agent") : l.who === "act" ? import_picocolors19.default.dim("act") : "you";
76845
+ const via = l.channel && l.channel !== "site" && l.who !== "act" ? import_picocolors19.default.dim(` (${l.channel})`) : "";
76846
+ process.stdout.write(` ${import_picocolors19.default.dim(l.at.slice(11, 16))} ${who}${via} ${l.words ?? import_picocolors19.default.dim("(does not open with this key)")}
76399
76847
  `);
76400
76848
  }
76401
76849
  process.stdout.write("\n");
76402
76850
  });
76403
76851
  } catch (err) {
76404
- fail6(opts, err);
76852
+ fail7(opts, err);
76405
76853
  }
76406
76854
  }
76407
76855
  async function agentBind(channel, senderId, opts) {
@@ -76412,10 +76860,10 @@ async function agentBind(channel, senderId, opts) {
76412
76860
  if (runsOnKeyOnly()) throw new WireError(401, "words_required", "binding a sender takes the account's words, and this machine runs on a key alone: run it where the words are", null);
76413
76861
  if (channel === "telegram") {
76414
76862
  const link = await mintTelegramLink(wallet);
76415
- emit10(opts, { ok: true, ...link }, () => {
76863
+ emit11(opts, { ok: true, ...link }, () => {
76416
76864
  process.stdout.write(`
76417
- ${import_picocolors18.default.green("\u2713")} open this in your Telegram and press Start: ${import_picocolors18.default.bold(link.link)}
76418
- ${import_picocolors18.default.dim(`It works once, until ${link.expiresAt.slice(11, 16)} UTC. Then write to @${link.to.telegram ?? "the bot"} to reach your agent.`)}
76865
+ ${import_picocolors19.default.green("\u2713")} open this in your Telegram and press Start: ${import_picocolors19.default.bold(link.link)}
76866
+ ${import_picocolors19.default.dim(`It works once, until ${link.expiresAt.slice(11, 16)} UTC. Then write to @${link.to.telegram ?? "the bot"} to reach your agent.`)}
76419
76867
 
76420
76868
  `);
76421
76869
  });
@@ -76423,21 +76871,21 @@ async function agentBind(channel, senderId, opts) {
76423
76871
  }
76424
76872
  if (channel === "whatsapp") {
76425
76873
  const link = await mintWhatsAppLink(wallet);
76426
- emit10(opts, { ok: true, ...link }, () => {
76874
+ emit11(opts, { ok: true, ...link }, () => {
76427
76875
  process.stdout.write(`
76428
- ${import_picocolors18.default.green("\u2713")} open this on your phone and press send: ${import_picocolors18.default.bold(link.link)}
76429
- ${import_picocolors18.default.dim(`It works once, until ${link.expiresAt.slice(11, 16)} UTC. Then write to ${link.to.whatsapp ?? "the house number"} on WhatsApp to reach your agent.`)}
76876
+ ${import_picocolors19.default.green("\u2713")} open this on your phone and press send: ${import_picocolors19.default.bold(link.link)}
76877
+ ${import_picocolors19.default.dim(`It works once, until ${link.expiresAt.slice(11, 16)} UTC. Then write to ${link.to.whatsapp ?? "the house number"} on WhatsApp to reach your agent.`)}
76430
76878
 
76431
76879
  `);
76432
76880
  });
76433
76881
  return;
76434
76882
  }
76435
76883
  const out = await mintBinding(wallet, channel, senderId);
76436
- emit10(opts, { ok: true, ...out }, () => {
76884
+ emit11(opts, { ok: true, ...out }, () => {
76437
76885
  const b2 = out.binding;
76438
76886
  if (b2.bound) {
76439
76887
  process.stdout.write(`
76440
- ${import_picocolors18.default.green("\u2713")} ${b2.senderId} is already bound to this agent.
76888
+ ${import_picocolors19.default.green("\u2713")} ${b2.senderId} is already bound to this agent.
76441
76889
 
76442
76890
  `);
76443
76891
  return;
@@ -76445,33 +76893,33 @@ async function agentBind(channel, senderId, opts) {
76445
76893
  if (b2.confirm) {
76446
76894
  const house = out.to.house?.mail ?? "the house address";
76447
76895
  process.stdout.write(out.sent ? `
76448
- ${import_picocolors18.default.green("\u2713")} a link went to ${b2.senderId} from ${house}: open it and press Confirm.
76449
- ${import_picocolors18.default.dim(`It works once, until ${(b2.expiresAt ?? "").slice(11, 16)} UTC. Then write to ${house} from that address to reach your agent.`)}
76896
+ ${import_picocolors19.default.green("\u2713")} a link went to ${b2.senderId} from ${house}: open it and press Confirm.
76897
+ ${import_picocolors19.default.dim(`It works once, until ${(b2.expiresAt ?? "").slice(11, 16)} UTC. Then write to ${house} from that address to reach your agent.`)}
76450
76898
 
76451
76899
  ` : `
76452
- ${import_picocolors18.default.green("\u2713")} a link went to ${b2.senderId} a moment ago: check its mail and press Confirm.
76900
+ ${import_picocolors19.default.green("\u2713")} a link went to ${b2.senderId} a moment ago: check its mail and press Confirm.
76453
76901
 
76454
76902
  `);
76455
76903
  return;
76456
76904
  }
76457
76905
  process.stdout.write(`
76458
- ${import_picocolors18.default.green("\u2713")} code ${import_picocolors18.default.bold(b2.code ?? "")} for ${b2.senderId}: ${sendTo(channel, out.to)}.
76459
- ${import_picocolors18.default.dim("Until the code arrives from that " + (channel === "sms" ? "number" : "address") + ", its messages land nothing and get one line back.")}
76906
+ ${import_picocolors19.default.green("\u2713")} code ${import_picocolors19.default.bold(b2.code ?? "")} for ${b2.senderId}: ${sendTo(channel, out.to)}.
76907
+ ${import_picocolors19.default.dim("Until the code arrives from that " + (channel === "sms" ? "number" : "address") + ", its messages land nothing and get one line back.")}
76460
76908
 
76461
76909
  `);
76462
76910
  });
76463
76911
  } catch (err) {
76464
- fail6(opts, err);
76912
+ fail7(opts, err);
76465
76913
  }
76466
76914
  }
76467
76915
  async function agentBindings(opts) {
76468
76916
  try {
76469
76917
  const { wallet } = await requirePasswordsKey();
76470
76918
  const read = await listBindings(wallet);
76471
- emit10(opts, { ok: true, ...read }, () => {
76919
+ emit11(opts, { ok: true, ...read }, () => {
76472
76920
  if (read.bindings.length === 0) {
76473
76921
  process.stdout.write(`
76474
- ${import_picocolors18.default.dim("nobody is bound yet")} ${import_picocolors18.default.dim("agentgates agent bind sms <number> | mail <address> | telegram | whatsapp")}
76922
+ ${import_picocolors19.default.dim("nobody is bound yet")} ${import_picocolors19.default.dim("agentgates agent bind sms <number> | mail <address> | telegram | whatsapp")}
76475
76923
 
76476
76924
  `);
76477
76925
  return;
@@ -76482,7 +76930,7 @@ async function agentBindings(opts) {
76482
76930
  process.stdout.write("\n");
76483
76931
  });
76484
76932
  } catch (err) {
76485
- fail6(opts, err);
76933
+ fail7(opts, err);
76486
76934
  }
76487
76935
  }
76488
76936
  async function agentUnbind(id2, opts) {
@@ -76490,28 +76938,28 @@ async function agentUnbind(id2, opts) {
76490
76938
  const { wallet } = await requirePasswordsKey();
76491
76939
  if (runsOnKeyOnly()) throw new WireError(401, "words_required", "unbinding a sender takes the account's words, and this machine runs on a key alone: run it where the words are", null);
76492
76940
  await revokeBinding(wallet, id2);
76493
- emit10(opts, { ok: true, revoked: id2 }, () => {
76941
+ emit11(opts, { ok: true, revoked: id2 }, () => {
76494
76942
  process.stdout.write(`
76495
- ${import_picocolors18.default.green("\u2713")} ${id2} is revoked; that sender is a stranger to the agent again.
76943
+ ${import_picocolors19.default.green("\u2713")} ${id2} is revoked; that sender is a stranger to the agent again.
76496
76944
 
76497
76945
  `);
76498
76946
  });
76499
76947
  } catch (err) {
76500
- fail6(opts, err);
76948
+ fail7(opts, err);
76501
76949
  }
76502
76950
  }
76503
76951
 
76504
76952
  // src/commands/logout.ts
76505
- var import_picocolors19 = __toESM(require_picocolors(), 1);
76953
+ var import_picocolors20 = __toESM(require_picocolors(), 1);
76506
76954
  async function logout(opts) {
76507
76955
  const requested = opts.profile ?? DEFAULT_PROFILE;
76508
76956
  const resolved = await resolveProfile(requested);
76509
76957
  if (!resolved) {
76510
- process.stdout.write(import_picocolors19.default.dim("Not logged in \u2014 nothing to log out.\n"));
76958
+ process.stdout.write(import_picocolors20.default.dim("Not logged in \u2014 nothing to log out.\n"));
76511
76959
  return;
76512
76960
  }
76513
76961
  if (resolved.autoSelected) {
76514
- process.stderr.write(import_picocolors19.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
76962
+ process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
76515
76963
  `));
76516
76964
  }
76517
76965
  const { profile, name: profileName } = resolved;
@@ -76536,15 +76984,15 @@ async function logout(opts) {
76536
76984
  const removed = await deleteProfile(profileName);
76537
76985
  if (removed) {
76538
76986
  process.stdout.write(
76539
- import_picocolors19.default.green(`\u2713 Logged out of profile ${import_picocolors19.default.bold(profileName)}.
76987
+ import_picocolors20.default.green(`\u2713 Logged out of profile ${import_picocolors20.default.bold(profileName)}.
76540
76988
  `)
76541
76989
  );
76542
76990
  }
76543
76991
  if (serverError) {
76544
76992
  process.stderr.write(
76545
- import_picocolors19.default.yellow(
76993
+ import_picocolors20.default.yellow(
76546
76994
  `\u26A0 Couldn't revoke server-side: ${serverError}
76547
- The local bearer is wiped. If the server still has it, revoke from ${import_picocolors19.default.bold("agentgates.ai/settings/pairings")}.
76995
+ The local bearer is wiped. If the server still has it, revoke from ${import_picocolors20.default.bold("agentgates.ai/settings/pairings")}.
76548
76996
  `
76549
76997
  )
76550
76998
  );
@@ -76552,17 +77000,17 @@ async function logout(opts) {
76552
77000
  }
76553
77001
 
76554
77002
  // src/commands/whoami.ts
76555
- var import_picocolors20 = __toESM(require_picocolors(), 1);
77003
+ var import_picocolors21 = __toESM(require_picocolors(), 1);
76556
77004
  init_constants();
76557
77005
  async function whoami(opts) {
76558
77006
  const requested = opts.profile ?? DEFAULT_PROFILE;
76559
77007
  const resolved = await resolveProfile(requested);
76560
77008
  if (!resolved) {
76561
- process.stderr.write(import_picocolors20.default.red("Not logged in. Run agentgates login first.\n"));
77009
+ process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
76562
77010
  process.exit(2);
76563
77011
  }
76564
77012
  if (resolved.autoSelected) {
76565
- process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77013
+ process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
76566
77014
  `));
76567
77015
  }
76568
77016
  const { profile, name: profileName } = resolved;
@@ -76571,7 +77019,7 @@ async function whoami(opts) {
76571
77019
  profile,
76572
77020
  profileName,
76573
77021
  jsonMode: jsonMode7,
76574
- ttyHeader: import_picocolors20.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77022
+ ttyHeader: import_picocolors21.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
76575
77023
  fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
76576
77024
  });
76577
77025
  if (outcome.kind === "auth_failed") {
@@ -76581,14 +77029,14 @@ async function whoami(opts) {
76581
77029
  );
76582
77030
  process.exit(1);
76583
77031
  }
76584
- process.stderr.write(import_picocolors20.default.red(`\u2715 ${outcome.reason}.
77032
+ process.stderr.write(import_picocolors21.default.red(`\u2715 ${outcome.reason}.
76585
77033
  `));
76586
77034
  process.exit(1);
76587
77035
  }
76588
77036
  if (outcome.kind === "error") {
76589
77037
  const err = outcome.error;
76590
77038
  if (err instanceof ApiError) {
76591
- process.stderr.write(import_picocolors20.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77039
+ process.stderr.write(import_picocolors21.default.red(`\u2715 ${err.message} (HTTP ${err.status})
76592
77040
  `));
76593
77041
  process.exit(1);
76594
77042
  }
@@ -76609,7 +77057,7 @@ async function whoami(opts) {
76609
77057
  process.stdout.write(`Solana ${me.solanaAddress}
76610
77058
  `);
76611
77059
  }
76612
- process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors20.default.dim("(none)")}
77060
+ process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors21.default.dim("(none)")}
76613
77061
  `);
76614
77062
  const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
76615
77063
  const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
@@ -76626,7 +77074,7 @@ async function whoami(opts) {
76626
77074
  `
76627
77075
  );
76628
77076
  process.stdout.write(
76629
- `Profile ${profileName === DEFAULT_PROFILE ? import_picocolors20.default.dim("(default)") : profileName}
77077
+ `Profile ${profileName === DEFAULT_PROFILE ? import_picocolors21.default.dim("(default)") : profileName}
76630
77078
  `
76631
77079
  );
76632
77080
  process.stdout.write(AI_DIRECTIVE + "\n");
@@ -76640,7 +77088,7 @@ function formatDate(iso) {
76640
77088
  }
76641
77089
 
76642
77090
  // src/commands/send.ts
76643
- var import_picocolors21 = __toESM(require_picocolors(), 1);
77091
+ var import_picocolors22 = __toESM(require_picocolors(), 1);
76644
77092
 
76645
77093
  // src/lib/status.ts
76646
77094
  var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
@@ -76681,7 +77129,7 @@ async function pollStatusUntilTerminal(opts) {
76681
77129
  });
76682
77130
  } catch (err) {
76683
77131
  if (err instanceof ApiError && err.status >= 500) {
76684
- await sleep2(opts.intervalMs);
77132
+ await sleep3(opts.intervalMs);
76685
77133
  continue;
76686
77134
  }
76687
77135
  throw err;
@@ -76693,7 +77141,7 @@ async function pollStatusUntilTerminal(opts) {
76693
77141
  if (isTerminalStatus(snap.status)) {
76694
77142
  return snap;
76695
77143
  }
76696
- await sleep2(opts.intervalMs);
77144
+ await sleep3(opts.intervalMs);
76697
77145
  }
76698
77146
  throw new Error(
76699
77147
  `Status poll timed out after ${Math.round(opts.giveUpMs / 6e4)} minutes (last status: ${last?.status ?? "unknown"})`
@@ -76728,20 +77176,20 @@ async function streamStatusUntilTerminal(opts) {
76728
77176
  if (err.status >= 400 && err.status < 500) {
76729
77177
  throw err;
76730
77178
  }
76731
- await sleep2(RECONNECT_BACKOFF_MS);
77179
+ await sleep3(RECONNECT_BACKOFF_MS);
76732
77180
  reconnects += 1;
76733
77181
  continue;
76734
77182
  }
76735
77183
  throw err;
76736
77184
  }
76737
77185
  reconnects += 1;
76738
- await sleep2(RECONNECT_BACKOFF_MS);
77186
+ await sleep3(RECONNECT_BACKOFF_MS);
76739
77187
  }
76740
77188
  throw new Error(
76741
77189
  `Status stream timed out after ${Math.round(opts.giveUpMs / 6e4)} minutes (last status: ${last?.status ?? "unknown"})`
76742
77190
  );
76743
77191
  }
76744
- function sleep2(ms) {
77192
+ function sleep3(ms) {
76745
77193
  return new Promise((resolve3) => setTimeout(resolve3, ms));
76746
77194
  }
76747
77195
 
@@ -76799,11 +77247,11 @@ async function send(amount, asset, opts) {
76799
77247
  const requested = opts.profile ?? DEFAULT_PROFILE;
76800
77248
  const resolved = await resolveProfile(requested);
76801
77249
  if (!resolved) {
76802
- process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
77250
+ process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
76803
77251
  process.exit(2);
76804
77252
  }
76805
77253
  if (resolved.autoSelected) {
76806
- process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77254
+ process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
76807
77255
  `));
76808
77256
  }
76809
77257
  const { profile, name: profileName } = resolved;
@@ -76812,7 +77260,7 @@ async function send(amount, asset, opts) {
76812
77260
  const amountNumber = Number(amount);
76813
77261
  if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
76814
77262
  process.stderr.write(
76815
- import_picocolors21.default.red(`\u2715 amount must be a positive number (got ${import_picocolors21.default.bold(amount)}).
77263
+ import_picocolors22.default.red(`\u2715 amount must be a positive number (got ${import_picocolors22.default.bold(amount)}).
76816
77264
  `)
76817
77265
  );
76818
77266
  process.exit(2);
@@ -76820,23 +77268,23 @@ async function send(amount, asset, opts) {
76820
77268
  const assetNormalized = asset.toLowerCase();
76821
77269
  if (assetNormalized !== "native" && assetNormalized !== "usdc") {
76822
77270
  process.stderr.write(
76823
- import_picocolors21.default.red(
76824
- `\u2715 asset must be ${import_picocolors21.default.bold("native")} or ${import_picocolors21.default.bold("usdc")} (got ${import_picocolors21.default.bold(asset)}).
77271
+ import_picocolors22.default.red(
77272
+ `\u2715 asset must be ${import_picocolors22.default.bold("native")} or ${import_picocolors22.default.bold("usdc")} (got ${import_picocolors22.default.bold(asset)}).
76825
77273
  `
76826
77274
  )
76827
77275
  );
76828
77276
  process.exit(2);
76829
77277
  }
76830
77278
  if (!opts.to || opts.to.trim() === "") {
76831
- process.stderr.write(import_picocolors21.default.red(`\u2715 --to <address> is required.
77279
+ process.stderr.write(import_picocolors22.default.red(`\u2715 --to <address> is required.
76832
77280
  `));
76833
77281
  process.exit(2);
76834
77282
  }
76835
77283
  if (isSolanaChainAlias(opts.chain)) {
76836
77284
  if (EVM_ADDRESS_RE.test(opts.to)) {
76837
77285
  process.stderr.write(
76838
- import_picocolors21.default.red(
76839
- `\u2715 --to looks like an EVM address (0x-hex), but --chain is ${import_picocolors21.default.bold("solana")}. Pass a base58 Solana pubkey, or pick an EVM chain.
77286
+ import_picocolors22.default.red(
77287
+ `\u2715 --to looks like an EVM address (0x-hex), but --chain is ${import_picocolors22.default.bold("solana")}. Pass a base58 Solana pubkey, or pick an EVM chain.
76840
77288
  `
76841
77289
  )
76842
77290
  );
@@ -76844,10 +77292,10 @@ async function send(amount, asset, opts) {
76844
77292
  }
76845
77293
  if (!SOLANA_ADDRESS_RE.test(opts.to)) {
76846
77294
  process.stderr.write(
76847
- import_picocolors21.default.red(
76848
- `\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${import_picocolors21.default.bold(opts.to)}).
77295
+ import_picocolors22.default.red(
77296
+ `\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${import_picocolors22.default.bold(opts.to)}).
76849
77297
  `
76850
- ) + import_picocolors21.default.dim(
77298
+ ) + import_picocolors22.default.dim(
76851
77299
  ` SNS resolution is deferred to a future server-side change;
76852
77300
  for now Solana sends require the literal pubkey.
76853
77301
  `
@@ -76858,8 +77306,8 @@ async function send(amount, asset, opts) {
76858
77306
  }
76859
77307
  if (!opts.userStated || opts.userStated.trim() === "") {
76860
77308
  process.stderr.write(
76861
- import_picocolors21.default.red(`\u2715 --user-stated <text> is required.
76862
- `) + import_picocolors21.default.dim(
77309
+ import_picocolors22.default.red(`\u2715 --user-stated <text> is required.
77310
+ `) + import_picocolors22.default.dim(
76863
77311
  ` This is the trust-gap defense: pass the verbatim user request so
76864
77312
  the approval modal can cross-check what the agent thinks the user
76865
77313
  asked for vs. the actual decoded transaction.
@@ -76877,7 +77325,7 @@ async function send(amount, asset, opts) {
76877
77325
  const n2 = Number(opts.maxUsd);
76878
77326
  if (!Number.isFinite(n2) || n2 <= 0) {
76879
77327
  process.stderr.write(
76880
- import_picocolors21.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
77328
+ import_picocolors22.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
76881
77329
  `)
76882
77330
  );
76883
77331
  process.exit(2);
@@ -76919,7 +77367,7 @@ async function send(amount, asset, opts) {
76919
77367
  profile: profileName,
76920
77368
  jsonMode: jsonMode7,
76921
77369
  origin: activeProfile.mcpOrigin,
76922
- ttyHeader: import_picocolors21.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
77370
+ ttyHeader: import_picocolors22.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
76923
77371
  });
76924
77372
  } catch (reloginErr) {
76925
77373
  if (jsonMode7) {
@@ -76931,7 +77379,7 @@ async function send(amount, asset, opts) {
76931
77379
  process.exit(1);
76932
77380
  }
76933
77381
  process.stderr.write(
76934
- import_picocolors21.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77382
+ import_picocolors22.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
76935
77383
  `)
76936
77384
  );
76937
77385
  process.exit(1);
@@ -76955,7 +77403,7 @@ async function send(amount, asset, opts) {
76955
77403
  process.exit(1);
76956
77404
  }
76957
77405
  process.stderr.write(
76958
- import_picocolors21.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
77406
+ import_picocolors22.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
76959
77407
  `)
76960
77408
  );
76961
77409
  process.exit(1);
@@ -76972,7 +77420,7 @@ async function send(amount, asset, opts) {
76972
77420
  });
76973
77421
  process.exit(1);
76974
77422
  }
76975
- process.stderr.write(import_picocolors21.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77423
+ process.stderr.write(import_picocolors22.default.red(`\u2715 ${err.message} (HTTP ${err.status})
76976
77424
  `));
76977
77425
  process.exit(1);
76978
77426
  } else {
@@ -76998,17 +77446,17 @@ async function send(amount, asset, opts) {
76998
77446
  if (proposed.detail) {
76999
77447
  const d = proposed.detail;
77000
77448
  process.stderr.write(
77001
- import_picocolors21.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
77449
+ import_picocolors22.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
77002
77450
  `
77003
77451
  );
77004
77452
  } else {
77005
- process.stderr.write(import_picocolors21.default.red(`\u2715 ${proposed.reason}
77453
+ process.stderr.write(import_picocolors22.default.red(`\u2715 ${proposed.reason}
77006
77454
  `));
77007
77455
  }
77008
77456
  if (proposed.upgrade_url) {
77009
77457
  process.stderr.write(
77010
77458
  ` Open this to grant access, then re-run the command:
77011
- ${import_picocolors21.default.cyan(proposed.upgrade_url)}
77459
+ ${import_picocolors22.default.cyan(proposed.upgrade_url)}
77012
77460
  `
77013
77461
  );
77014
77462
  }
@@ -77018,21 +77466,21 @@ async function send(amount, asset, opts) {
77018
77466
  const a = proposed.recommended_actions[i];
77019
77467
  process.stderr.write(` ${i + 1}. ${a.label}
77020
77468
  `);
77021
- if (a.reasoning) process.stderr.write(import_picocolors21.default.dim(` ${a.reasoning}
77469
+ if (a.reasoning) process.stderr.write(import_picocolors22.default.dim(` ${a.reasoning}
77022
77470
  `));
77023
77471
  if (a.action_intent && a.action_intent.external_url) {
77024
77472
  process.stderr.write(
77025
- ` ${import_picocolors21.default.cyan(a.action_intent.external_url)}
77473
+ ` ${import_picocolors22.default.cyan(a.action_intent.external_url)}
77026
77474
  `
77027
77475
  );
77028
77476
  }
77029
77477
  }
77030
77478
  }
77031
77479
  if (proposed.suggestions && proposed.suggestions.length > 0) {
77032
- process.stderr.write(import_picocolors21.default.dim("\n Other ways to fund:\n"));
77480
+ process.stderr.write(import_picocolors22.default.dim("\n Other ways to fund:\n"));
77033
77481
  for (const s of proposed.suggestions) {
77034
77482
  if (s.kind === "ask_user") continue;
77035
- process.stderr.write(import_picocolors21.default.dim(` \u2022 ${s.label}
77483
+ process.stderr.write(import_picocolors22.default.dim(` \u2022 ${s.label}
77036
77484
  `));
77037
77485
  }
77038
77486
  }
@@ -77059,8 +77507,8 @@ async function send(amount, asset, opts) {
77059
77507
  } else {
77060
77508
  process.stdout.write(
77061
77509
  `
77062
- ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with biometric:
77063
- ${import_picocolors21.default.cyan(proposed.approval_url)}
77510
+ ${import_picocolors22.default.bold("Proposed.")} Open this URL to approve with biometric:
77511
+ ${import_picocolors22.default.cyan(proposed.approval_url)}
77064
77512
 
77065
77513
  `
77066
77514
  );
@@ -77079,7 +77527,7 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77079
77527
  if (jsonMode7) {
77080
77528
  emitNdjson({ status: s.status, intent_id: s.approval_id });
77081
77529
  } else {
77082
- process.stdout.write(` ${describeStatus(s.status)}${import_picocolors21.default.dim("\u2026")}\r`);
77530
+ process.stdout.write(` ${describeStatus(s.status)}${import_picocolors22.default.dim("\u2026")}\r`);
77083
77531
  }
77084
77532
  }
77085
77533
  });
@@ -77093,7 +77541,7 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77093
77541
  profile: profileName,
77094
77542
  jsonMode: jsonMode7,
77095
77543
  origin: activeProfile.mcpOrigin,
77096
- ttyHeader: import_picocolors21.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
77544
+ ttyHeader: import_picocolors22.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
77097
77545
  });
77098
77546
  } catch (reloginErr) {
77099
77547
  if (jsonMode7) {
@@ -77106,7 +77554,7 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77106
77554
  process.exit(1);
77107
77555
  }
77108
77556
  process.stderr.write(
77109
- "\n" + import_picocolors21.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77557
+ "\n" + import_picocolors22.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77110
77558
  `)
77111
77559
  );
77112
77560
  process.exit(1);
@@ -77124,7 +77572,7 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77124
77572
  process.exit(1);
77125
77573
  }
77126
77574
  process.stderr.write(
77127
- "\n" + import_picocolors21.default.red(`\u2715 Status poll failed: ${retryErr.message}
77575
+ "\n" + import_picocolors22.default.red(`\u2715 Status poll failed: ${retryErr.message}
77128
77576
  `)
77129
77577
  );
77130
77578
  process.exit(1);
@@ -77140,7 +77588,7 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77140
77588
  process.exit(1);
77141
77589
  }
77142
77590
  process.stderr.write(
77143
- "\n" + import_picocolors21.default.red(`\u2715 Status poll failed: ${err.message}
77591
+ "\n" + import_picocolors22.default.red(`\u2715 Status poll failed: ${err.message}
77144
77592
  `)
77145
77593
  );
77146
77594
  process.exit(1);
@@ -77160,19 +77608,19 @@ ${import_picocolors21.default.bold("Proposed.")} Open this URL to approve with b
77160
77608
  }
77161
77609
  process.stdout.write("\n");
77162
77610
  if (final.status === "mined") {
77163
- process.stdout.write(import_picocolors21.default.green("\u2713 Mined.") + "\n");
77611
+ process.stdout.write(import_picocolors22.default.green("\u2713 Mined.") + "\n");
77164
77612
  if (final.tx_hash) {
77165
77613
  process.stdout.write(` Tx ${final.tx_hash}
77166
77614
  `);
77167
77615
  }
77168
77616
  if (explorer) {
77169
- process.stdout.write(` Explorer ${import_picocolors21.default.cyan(explorer)}
77617
+ process.stdout.write(` Explorer ${import_picocolors22.default.cyan(explorer)}
77170
77618
  `);
77171
77619
  }
77172
77620
  process.exit(0);
77173
77621
  }
77174
77622
  const label = final.status === "rejected" ? "Rejected by user" : final.status === "expired" ? "Expired (TTL elapsed before approval)" : final.status === "failed" ? "Broadcast failed" : `Ended in unexpected status: ${final.status}`;
77175
- process.stderr.write(import_picocolors21.default.red(`\u2715 ${label}.
77623
+ process.stderr.write(import_picocolors22.default.red(`\u2715 ${label}.
77176
77624
  `));
77177
77625
  process.exit(1);
77178
77626
  }
@@ -77200,7 +77648,7 @@ function describeStatus(s) {
77200
77648
  }
77201
77649
 
77202
77650
  // src/commands/status.ts
77203
- var import_picocolors22 = __toESM(require_picocolors(), 1);
77651
+ var import_picocolors23 = __toESM(require_picocolors(), 1);
77204
77652
  init_constants();
77205
77653
  var WATCH_GIVEUP_MS = 10 * 6e4;
77206
77654
  function explorerUrl2(chainId, hash2) {
@@ -77219,17 +77667,17 @@ function explorerUrl2(chainId, hash2) {
77219
77667
  }
77220
77668
  async function status3(intentId, opts) {
77221
77669
  if (!intentId || intentId.trim() === "") {
77222
- process.stderr.write(import_picocolors22.default.red("\u2715 Missing intent id.\n"));
77670
+ process.stderr.write(import_picocolors23.default.red("\u2715 Missing intent id.\n"));
77223
77671
  process.exit(2);
77224
77672
  }
77225
77673
  const requested = opts.profile ?? DEFAULT_PROFILE;
77226
77674
  const resolved = await resolveProfile(requested);
77227
77675
  if (!resolved) {
77228
- process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
77676
+ process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
77229
77677
  process.exit(2);
77230
77678
  }
77231
77679
  if (resolved.autoSelected) {
77232
- process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77680
+ process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77233
77681
  `));
77234
77682
  }
77235
77683
  const { profile, name: profileName } = resolved;
@@ -77238,7 +77686,7 @@ async function status3(intentId, opts) {
77238
77686
  profile,
77239
77687
  profileName,
77240
77688
  jsonMode: jsonMode7,
77241
- ttyHeader: import_picocolors22.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77689
+ ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77242
77690
  fn: (bearer, origin) => fetchStatus({ intentId, bearer, origin })
77243
77691
  });
77244
77692
  if (outcome.kind === "auth_failed") {
@@ -77248,7 +77696,7 @@ async function status3(intentId, opts) {
77248
77696
  );
77249
77697
  process.exit(1);
77250
77698
  }
77251
- process.stderr.write(import_picocolors22.default.red(`\u2715 ${outcome.reason}.
77699
+ process.stderr.write(import_picocolors23.default.red(`\u2715 ${outcome.reason}.
77252
77700
  `));
77253
77701
  process.exit(1);
77254
77702
  }
@@ -77256,11 +77704,11 @@ async function status3(intentId, opts) {
77256
77704
  const err = outcome.error;
77257
77705
  if (err instanceof ApiError) {
77258
77706
  if (err.status === 404) {
77259
- process.stderr.write(import_picocolors22.default.red(`\u2715 No intent with id ${intentId}.
77707
+ process.stderr.write(import_picocolors23.default.red(`\u2715 No intent with id ${intentId}.
77260
77708
  `));
77261
77709
  process.exit(1);
77262
77710
  }
77263
- process.stderr.write(import_picocolors22.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77711
+ process.stderr.write(import_picocolors23.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77264
77712
  `));
77265
77713
  process.exit(1);
77266
77714
  }
@@ -77271,7 +77719,7 @@ async function status3(intentId, opts) {
77271
77719
  if (opts.watch && !isTerminalStatus(snap.status)) {
77272
77720
  if (!jsonMode7) {
77273
77721
  printSnap(snap);
77274
- process.stdout.write(import_picocolors22.default.dim("Watching\u2026\n"));
77722
+ process.stdout.write(import_picocolors23.default.dim("Watching\u2026\n"));
77275
77723
  }
77276
77724
  const runWatchPoll = (p) => streamStatusUntilTerminal({
77277
77725
  intentId,
@@ -77282,7 +77730,7 @@ async function status3(intentId, opts) {
77282
77730
  giveUpMs: WATCH_GIVEUP_MS,
77283
77731
  onTick: (s) => {
77284
77732
  if (!jsonMode7) {
77285
- process.stdout.write(` ${import_picocolors22.default.dim("\u2192")} ${s.status}
77733
+ process.stdout.write(` ${import_picocolors23.default.dim("\u2192")} ${s.status}
77286
77734
  `);
77287
77735
  }
77288
77736
  }
@@ -77297,7 +77745,7 @@ async function status3(intentId, opts) {
77297
77745
  profile: profileName,
77298
77746
  jsonMode: jsonMode7,
77299
77747
  origin: activeProfile.mcpOrigin,
77300
- ttyHeader: import_picocolors22.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
77748
+ ttyHeader: import_picocolors23.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
77301
77749
  });
77302
77750
  } catch (reloginErr) {
77303
77751
  if (jsonMode7) {
@@ -77311,7 +77759,7 @@ async function status3(intentId, opts) {
77311
77759
  process.exit(1);
77312
77760
  }
77313
77761
  process.stderr.write(
77314
- import_picocolors22.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77762
+ import_picocolors23.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77315
77763
  `)
77316
77764
  );
77317
77765
  process.exit(1);
@@ -77319,12 +77767,12 @@ async function status3(intentId, opts) {
77319
77767
  try {
77320
77768
  final = await runWatchPoll(activeProfile);
77321
77769
  } catch (retryErr) {
77322
- process.stderr.write(import_picocolors22.default.red(`\u2715 ${retryErr.message}
77770
+ process.stderr.write(import_picocolors23.default.red(`\u2715 ${retryErr.message}
77323
77771
  `));
77324
77772
  process.exit(1);
77325
77773
  }
77326
77774
  } else {
77327
- process.stderr.write(import_picocolors22.default.red(`\u2715 ${err.message}
77775
+ process.stderr.write(import_picocolors23.default.red(`\u2715 ${err.message}
77328
77776
  `));
77329
77777
  process.exit(1);
77330
77778
  }
@@ -77345,7 +77793,7 @@ async function status3(intentId, opts) {
77345
77793
  }
77346
77794
  function printSnap(s) {
77347
77795
  const explorer = s.tx_hash ? explorerUrl2(s.chain_id, s.tx_hash) : null;
77348
- const colorFn = s.status === "mined" ? import_picocolors22.default.green : s.status === "rejected" || s.status === "expired" || s.status === "failed" ? import_picocolors22.default.red : import_picocolors22.default.cyan;
77796
+ const colorFn = s.status === "mined" ? import_picocolors23.default.green : s.status === "rejected" || s.status === "expired" || s.status === "failed" ? import_picocolors23.default.red : import_picocolors23.default.cyan;
77349
77797
  process.stdout.write(`Intent ${s.approval_id}
77350
77798
  `);
77351
77799
  process.stdout.write(`Status ${colorFn(s.status)}
@@ -77360,12 +77808,12 @@ function printSnap(s) {
77360
77808
  process.stdout.write(`Tx ${s.tx_hash}
77361
77809
  `);
77362
77810
  if (explorer) {
77363
- process.stdout.write(`Explorer ${import_picocolors22.default.cyan(explorer)}
77811
+ process.stdout.write(`Explorer ${import_picocolors23.default.cyan(explorer)}
77364
77812
  `);
77365
77813
  }
77366
77814
  }
77367
77815
  if (!isTerminalStatus(s.status)) {
77368
- process.stdout.write(`Approve ${import_picocolors22.default.cyan(s.approval_url)}
77816
+ process.stdout.write(`Approve ${import_picocolors23.default.cyan(s.approval_url)}
77369
77817
  `);
77370
77818
  }
77371
77819
  process.stdout.write(`Created ${formatDate2(s.created_at)}
@@ -77382,7 +77830,7 @@ function formatDate2(iso) {
77382
77830
  }
77383
77831
 
77384
77832
  // src/commands/balance.ts
77385
- var import_picocolors23 = __toESM(require_picocolors(), 1);
77833
+ var import_picocolors24 = __toESM(require_picocolors(), 1);
77386
77834
  init_constants();
77387
77835
  var CHAIN_ALIASES = {
77388
77836
  "1": 1,
@@ -77406,11 +77854,11 @@ async function balance(opts) {
77406
77854
  const requested = opts.profile ?? DEFAULT_PROFILE;
77407
77855
  const resolved = await resolveProfile(requested);
77408
77856
  if (!resolved) {
77409
- process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
77857
+ process.stderr.write(import_picocolors24.default.red("Not logged in. Run agentgates login first.\n"));
77410
77858
  process.exit(2);
77411
77859
  }
77412
77860
  if (resolved.autoSelected) {
77413
- process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77861
+ process.stderr.write(import_picocolors24.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77414
77862
  `));
77415
77863
  }
77416
77864
  const { profile, name: profileName } = resolved;
@@ -77420,8 +77868,8 @@ async function balance(opts) {
77420
77868
  const id2 = CHAIN_ALIASES[key];
77421
77869
  if (id2 === void 0) {
77422
77870
  process.stderr.write(
77423
- import_picocolors23.default.red(
77424
- `\u2715 Unknown chain ${import_picocolors23.default.bold(opts.chain)}. Supported: ${import_picocolors23.default.bold("1/ethereum")}, ${import_picocolors23.default.bold("137/polygon")}, ${import_picocolors23.default.bold("8453/base")}, ${import_picocolors23.default.bold("42161/arbitrum")}, ${import_picocolors23.default.bold("900/solana")}.
77871
+ import_picocolors24.default.red(
77872
+ `\u2715 Unknown chain ${import_picocolors24.default.bold(opts.chain)}. Supported: ${import_picocolors24.default.bold("1/ethereum")}, ${import_picocolors24.default.bold("137/polygon")}, ${import_picocolors24.default.bold("8453/base")}, ${import_picocolors24.default.bold("42161/arbitrum")}, ${import_picocolors24.default.bold("900/solana")}.
77425
77873
  `
77426
77874
  )
77427
77875
  );
@@ -77434,7 +77882,7 @@ async function balance(opts) {
77434
77882
  profile,
77435
77883
  profileName,
77436
77884
  jsonMode: jsonMode7,
77437
- ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77885
+ ttyHeader: import_picocolors24.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77438
77886
  fn: (bearer, origin) => apiFetch("/api/balances", { bearer, origin })
77439
77887
  });
77440
77888
  if (outcome.kind === "auth_failed") {
@@ -77444,14 +77892,14 @@ async function balance(opts) {
77444
77892
  );
77445
77893
  process.exit(1);
77446
77894
  }
77447
- process.stderr.write(import_picocolors23.default.red(`\u2715 ${outcome.reason}.
77895
+ process.stderr.write(import_picocolors24.default.red(`\u2715 ${outcome.reason}.
77448
77896
  `));
77449
77897
  process.exit(1);
77450
77898
  }
77451
77899
  if (outcome.kind === "error") {
77452
77900
  const err = outcome.error;
77453
77901
  if (err instanceof ApiError) {
77454
- process.stderr.write(import_picocolors23.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77902
+ process.stderr.write(import_picocolors24.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77455
77903
  `));
77456
77904
  process.exit(1);
77457
77905
  }
@@ -77481,7 +77929,7 @@ async function balance(opts) {
77481
77929
  }
77482
77930
  if (filtered.length === 0) {
77483
77931
  process.stdout.write(
77484
- import_picocolors23.default.dim(
77932
+ import_picocolors24.default.dim(
77485
77933
  chainFilter !== null ? `No balances on chain ${chainFilter}.
77486
77934
  ` : `No chain balances returned.
77487
77935
  `
@@ -77493,7 +77941,7 @@ async function balance(opts) {
77493
77941
  const errorLines = [];
77494
77942
  for (const c of filtered) {
77495
77943
  if (c.error) {
77496
- errorLines.push(`${c.chainName} ${import_picocolors23.default.red(`(read failed: ${c.error})`)}`);
77944
+ errorLines.push(`${c.chainName} ${import_picocolors24.default.red(`(read failed: ${c.error})`)}`);
77497
77945
  continue;
77498
77946
  }
77499
77947
  if (c.native.balance > 0) {
@@ -77514,7 +77962,7 @@ async function balance(opts) {
77514
77962
  }
77515
77963
  }
77516
77964
  if (rows.length === 0 && errorLines.length === 0) {
77517
- process.stdout.write(import_picocolors23.default.dim(`All balances are zero.
77965
+ process.stdout.write(import_picocolors24.default.dim(`All balances are zero.
77518
77966
  `));
77519
77967
  process.stdout.write(AI_DIRECTIVE + "\n");
77520
77968
  return;
@@ -77524,7 +77972,7 @@ async function balance(opts) {
77524
77972
  const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
77525
77973
  const colBalance = Math.max(7, ...rows.map((r) => r.balance.length));
77526
77974
  const header = "Chain".padEnd(colChain) + " " + "Asset".padEnd(colAsset) + " " + "Balance".padStart(colBalance);
77527
- process.stdout.write(import_picocolors23.default.dim(header) + "\n");
77975
+ process.stdout.write(import_picocolors24.default.dim(header) + "\n");
77528
77976
  for (const r of rows) {
77529
77977
  process.stdout.write(
77530
77978
  r.chain.padEnd(colChain) + " " + r.asset.padEnd(colAsset) + " " + r.balance.padStart(colBalance) + "\n"
@@ -77537,7 +77985,7 @@ async function balance(opts) {
77537
77985
  `);
77538
77986
  }
77539
77987
  if (res.fetched_at) {
77540
- process.stdout.write("\n" + import_picocolors23.default.dim(`Fetched ${res.fetched_at}
77988
+ process.stdout.write("\n" + import_picocolors24.default.dim(`Fetched ${res.fetched_at}
77541
77989
  `));
77542
77990
  }
77543
77991
  process.stdout.write(AI_DIRECTIVE + "\n");
@@ -77550,7 +77998,7 @@ function formatBalance(value, decimals) {
77550
77998
  }
77551
77999
 
77552
78000
  // src/commands/history.ts
77553
- var import_picocolors24 = __toESM(require_picocolors(), 1);
78001
+ var import_picocolors25 = __toESM(require_picocolors(), 1);
77554
78002
  init_constants();
77555
78003
  var DEFAULT_LIMIT = 20;
77556
78004
  var SERVER_MAX_LIMIT = 100;
@@ -77558,11 +78006,11 @@ async function history(opts) {
77558
78006
  const requested = opts.profile ?? DEFAULT_PROFILE;
77559
78007
  const resolved = await resolveProfile(requested);
77560
78008
  if (!resolved) {
77561
- process.stderr.write(import_picocolors24.default.red("Not logged in. Run agentgates login first.\n"));
78009
+ process.stderr.write(import_picocolors25.default.red("Not logged in. Run agentgates login first.\n"));
77562
78010
  process.exit(2);
77563
78011
  }
77564
78012
  if (resolved.autoSelected) {
77565
- process.stderr.write(import_picocolors24.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78013
+ process.stderr.write(import_picocolors25.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
77566
78014
  `));
77567
78015
  }
77568
78016
  const { profile, name: profileName } = resolved;
@@ -77571,14 +78019,14 @@ async function history(opts) {
77571
78019
  const n2 = Number(opts.limit);
77572
78020
  if (!Number.isFinite(n2) || n2 <= 0 || !Number.isInteger(n2)) {
77573
78021
  process.stderr.write(
77574
- import_picocolors24.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors24.default.bold(opts.limit)}).
78022
+ import_picocolors25.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors25.default.bold(opts.limit)}).
77575
78023
  `)
77576
78024
  );
77577
78025
  process.exit(2);
77578
78026
  }
77579
78027
  if (n2 > SERVER_MAX_LIMIT) {
77580
78028
  process.stderr.write(
77581
- import_picocolors24.default.red(
78029
+ import_picocolors25.default.red(
77582
78030
  `\u2715 --limit max is ${SERVER_MAX_LIMIT} (the server's wallet://history hard cap). Got ${n2}.
77583
78031
  `
77584
78032
  )
@@ -77592,7 +78040,7 @@ async function history(opts) {
77592
78040
  profile,
77593
78041
  profileName,
77594
78042
  jsonMode: jsonMode7,
77595
- ttyHeader: import_picocolors24.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
78043
+ ttyHeader: import_picocolors25.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
77596
78044
  fn: (bearer, origin) => apiFetch(
77597
78045
  `/api/history?limit=${encodeURIComponent(String(limit))}`,
77598
78046
  { bearer, origin }
@@ -77605,14 +78053,14 @@ async function history(opts) {
77605
78053
  );
77606
78054
  process.exit(1);
77607
78055
  }
77608
- process.stderr.write(import_picocolors24.default.red(`\u2715 ${outcome.reason}.
78056
+ process.stderr.write(import_picocolors25.default.red(`\u2715 ${outcome.reason}.
77609
78057
  `));
77610
78058
  process.exit(1);
77611
78059
  }
77612
78060
  if (outcome.kind === "error") {
77613
78061
  const err = outcome.error;
77614
78062
  if (err instanceof ApiError) {
77615
- process.stderr.write(import_picocolors24.default.red(`\u2715 ${err.message} (HTTP ${err.status})
78063
+ process.stderr.write(import_picocolors25.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77616
78064
  `));
77617
78065
  process.exit(1);
77618
78066
  }
@@ -77629,7 +78077,7 @@ async function history(opts) {
77629
78077
  return;
77630
78078
  }
77631
78079
  if (res.txs.length === 0) {
77632
- process.stdout.write(import_picocolors24.default.dim(`No activity yet.
78080
+ process.stdout.write(import_picocolors25.default.dim(`No activity yet.
77633
78081
  `));
77634
78082
  return;
77635
78083
  }
@@ -77649,7 +78097,7 @@ async function history(opts) {
77649
78097
  const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
77650
78098
  const colTo = Math.max(2, ...rows.map((r) => r.to.length));
77651
78099
  const header = "When".padEnd(colWhen) + " " + "Chain".padEnd(colChain) + " " + "Type".padEnd(colType) + " " + "Amount".padStart(colAmount) + " " + "Asset".padEnd(colAsset) + " " + "To".padEnd(colTo) + " Hash";
77652
- process.stdout.write(import_picocolors24.default.dim(header) + "\n");
78100
+ process.stdout.write(import_picocolors25.default.dim(header) + "\n");
77653
78101
  for (const r of rows) {
77654
78102
  process.stdout.write(
77655
78103
  r.when.padEnd(colWhen) + " " + r.chain.padEnd(colChain) + " " + r.type.padEnd(colType) + " " + r.amount.padStart(colAmount) + " " + r.asset.padEnd(colAsset) + " " + r.to.padEnd(colTo) + " " + r.hash + "\n"
@@ -77657,7 +78105,7 @@ async function history(opts) {
77657
78105
  }
77658
78106
  if (res.fetched_at) {
77659
78107
  process.stdout.write(
77660
- "\n" + import_picocolors24.default.dim(
78108
+ "\n" + import_picocolors25.default.dim(
77661
78109
  `Showing ${rows.length} of limit ${res.limit ?? limit} \xB7 fetched ${res.fetched_at}
77662
78110
  `
77663
78111
  )
@@ -77744,10 +78192,10 @@ function prettyType(activityType, status4) {
77744
78192
  }
77745
78193
 
77746
78194
  // src/commands/swap.ts
77747
- var import_picocolors26 = __toESM(require_picocolors(), 1);
78195
+ var import_picocolors27 = __toESM(require_picocolors(), 1);
77748
78196
 
77749
78197
  // src/lib/intent-flow.ts
77750
- var import_picocolors25 = __toESM(require_picocolors(), 1);
78198
+ var import_picocolors26 = __toESM(require_picocolors(), 1);
77751
78199
  var STREAM_GIVEUP_MS = 10 * 6e4;
77752
78200
  var SOLANA_CHAIN_ID2 = 900;
77753
78201
  function isBlocked2(r) {
@@ -77822,7 +78270,7 @@ async function runIntentFlow(opts) {
77822
78270
  profile: opts.profileName,
77823
78271
  jsonMode: opts.jsonMode,
77824
78272
  origin: activeProfile.mcpOrigin,
77825
- ttyHeader: import_picocolors25.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
78273
+ ttyHeader: import_picocolors26.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
77826
78274
  });
77827
78275
  } catch (reloginErr) {
77828
78276
  if (opts.jsonMode) {
@@ -77834,7 +78282,7 @@ async function runIntentFlow(opts) {
77834
78282
  process.exit(1);
77835
78283
  }
77836
78284
  process.stderr.write(
77837
- import_picocolors25.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
78285
+ import_picocolors26.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77838
78286
  `)
77839
78287
  );
77840
78288
  process.exit(1);
@@ -77858,7 +78306,7 @@ async function runIntentFlow(opts) {
77858
78306
  process.exit(1);
77859
78307
  }
77860
78308
  process.stderr.write(
77861
- import_picocolors25.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
78309
+ import_picocolors26.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
77862
78310
  `)
77863
78311
  );
77864
78312
  process.exit(1);
@@ -77875,7 +78323,7 @@ async function runIntentFlow(opts) {
77875
78323
  });
77876
78324
  process.exit(1);
77877
78325
  }
77878
- process.stderr.write(import_picocolors25.default.red(`\u2715 ${err.message} (HTTP ${err.status})
78326
+ process.stderr.write(import_picocolors26.default.red(`\u2715 ${err.message} (HTTP ${err.status})
77879
78327
  `));
77880
78328
  process.exit(1);
77881
78329
  } else {
@@ -77897,18 +78345,18 @@ async function runIntentFlow(opts) {
77897
78345
  });
77898
78346
  process.exit(1);
77899
78347
  }
77900
- process.stderr.write(import_picocolors25.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
78348
+ process.stderr.write(import_picocolors26.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
77901
78349
  `));
77902
78350
  if (proposed.upgrade_url) {
77903
78351
  process.stderr.write(
77904
78352
  ` Open this to grant access, then re-run the command:
77905
- ${import_picocolors25.default.cyan(proposed.upgrade_url)}
78353
+ ${import_picocolors26.default.cyan(proposed.upgrade_url)}
77906
78354
  `
77907
78355
  );
77908
78356
  }
77909
78357
  if (proposed.recommended_actions && proposed.recommended_actions.length > 0) {
77910
78358
  process.stderr.write(
77911
- import_picocolors25.default.dim(
78359
+ import_picocolors26.default.dim(
77912
78360
  ` Suggested actions:
77913
78361
  ` + proposed.recommended_actions.map((a) => ` \u2022 ${JSON.stringify(a)}`).join("\n") + "\n"
77914
78362
  )
@@ -77931,8 +78379,8 @@ async function runIntentFlow(opts) {
77931
78379
  } else {
77932
78380
  process.stdout.write(
77933
78381
  `
77934
- ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with biometric:
77935
- ${import_picocolors25.default.cyan(proposed.approval_url)}
78382
+ ${import_picocolors26.default.bold("Proposed.")} Open this URL to approve with biometric:
78383
+ ${import_picocolors26.default.cyan(proposed.approval_url)}
77936
78384
 
77937
78385
  `
77938
78386
  );
@@ -77961,10 +78409,10 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
77961
78409
  });
77962
78410
  } else if (retryable) {
77963
78411
  process.stdout.write(
77964
- ` ${import_picocolors25.default.red("\u2715 failed")} \u2014 retry it on the approve page: ${import_picocolors25.default.cyan(proposed.approval_url)} ` + import_picocolors25.default.dim(`(until ${new Date(proposed.expires_at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })})`) + "\n"
78412
+ ` ${import_picocolors26.default.red("\u2715 failed")} \u2014 retry it on the approve page: ${import_picocolors26.default.cyan(proposed.approval_url)} ` + import_picocolors26.default.dim(`(until ${new Date(proposed.expires_at).toLocaleTimeString([], { hour: "numeric", minute: "2-digit" })})`) + "\n"
77965
78413
  );
77966
78414
  } else {
77967
- process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors25.default.dim("\u2026")}\r`);
78415
+ process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors26.default.dim("\u2026")}\r`);
77968
78416
  }
77969
78417
  }
77970
78418
  });
@@ -77978,7 +78426,7 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
77978
78426
  profile: opts.profileName,
77979
78427
  jsonMode: opts.jsonMode,
77980
78428
  origin: activeProfile.mcpOrigin,
77981
- ttyHeader: import_picocolors25.default.dim(
78429
+ ttyHeader: import_picocolors26.default.dim(
77982
78430
  "Bearer expired mid-poll \u2014 re-pairing this terminal\u2026"
77983
78431
  )
77984
78432
  });
@@ -77993,7 +78441,7 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
77993
78441
  process.exit(1);
77994
78442
  }
77995
78443
  process.stderr.write(
77996
- "\n" + import_picocolors25.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
78444
+ "\n" + import_picocolors26.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
77997
78445
  `)
77998
78446
  );
77999
78447
  process.exit(1);
@@ -78011,7 +78459,7 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
78011
78459
  process.exit(1);
78012
78460
  }
78013
78461
  process.stderr.write(
78014
- "\n" + import_picocolors25.default.red(`\u2715 Status poll failed: ${retryErr.message}
78462
+ "\n" + import_picocolors26.default.red(`\u2715 Status poll failed: ${retryErr.message}
78015
78463
  `)
78016
78464
  );
78017
78465
  process.exit(1);
@@ -78027,7 +78475,7 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
78027
78475
  process.exit(1);
78028
78476
  }
78029
78477
  process.stderr.write(
78030
- "\n" + import_picocolors25.default.red(`\u2715 Status poll failed: ${err.message}
78478
+ "\n" + import_picocolors26.default.red(`\u2715 Status poll failed: ${err.message}
78031
78479
  `)
78032
78480
  );
78033
78481
  process.exit(1);
@@ -78068,39 +78516,39 @@ ${import_picocolors25.default.bold("Proposed.")} Open this URL to approve with b
78068
78516
  process.stdout.write("\n");
78069
78517
  const printLegJournal = () => {
78070
78518
  if (legs.length === 0) return;
78071
- process.stdout.write(import_picocolors25.default.bold(" Legs:\n"));
78519
+ process.stdout.write(import_picocolors26.default.bold(" Legs:\n"));
78072
78520
  for (const l of legs) {
78073
- const line2 = l.status === "mined" ? import_picocolors25.default.green(`\u2713 leg ${l.index + 1} mined`) + (l.tx_hash ? import_picocolors25.default.dim(` ${l.tx_hash}`) : "") : l.status === "failed" ? import_picocolors25.default.red(`\u2715 leg ${l.index + 1} failed`) + (l.failure?.message ? ` \u2014 ${l.failure.message}` : "") : l.status === "pending" || l.status === "rendered" ? import_picocolors25.default.dim(`\u2013 leg ${l.index + 1} not run`) : import_picocolors25.default.dim(`\u2026 leg ${l.index + 1} ${l.status}`);
78521
+ const line2 = l.status === "mined" ? import_picocolors26.default.green(`\u2713 leg ${l.index + 1} mined`) + (l.tx_hash ? import_picocolors26.default.dim(` ${l.tx_hash}`) : "") : l.status === "failed" ? import_picocolors26.default.red(`\u2715 leg ${l.index + 1} failed`) + (l.failure?.message ? ` \u2014 ${l.failure.message}` : "") : l.status === "pending" || l.status === "rendered" ? import_picocolors26.default.dim(`\u2013 leg ${l.index + 1} not run`) : import_picocolors26.default.dim(`\u2026 leg ${l.index + 1} ${l.status}`);
78074
78522
  process.stdout.write(` ${line2}
78075
78523
  `);
78076
78524
  }
78077
78525
  };
78078
78526
  if (final.status === "mined") {
78079
- process.stdout.write(import_picocolors25.default.green("\u2713 Mined.") + "\n");
78527
+ process.stdout.write(import_picocolors26.default.green("\u2713 Mined.") + "\n");
78080
78528
  if (final.tx_hash) {
78081
78529
  process.stdout.write(` Tx ${final.tx_hash}
78082
78530
  `);
78083
78531
  }
78084
78532
  if (explorer) {
78085
- process.stdout.write(` Explorer ${import_picocolors25.default.cyan(explorer)}
78533
+ process.stdout.write(` Explorer ${import_picocolors26.default.cyan(explorer)}
78086
78534
  `);
78087
78535
  }
78088
78536
  printLegJournal();
78089
78537
  process.exit(0);
78090
78538
  }
78091
78539
  if (final.status === "failed" && failure?.message) {
78092
- process.stderr.write(import_picocolors25.default.red(`\u2715 ${failure.message}
78540
+ process.stderr.write(import_picocolors26.default.red(`\u2715 ${failure.message}
78093
78541
  `));
78094
78542
  if (retryCommand) {
78095
78543
  process.stderr.write(` Retry:
78096
- ${import_picocolors25.default.cyan(retryCommand)}
78544
+ ${import_picocolors26.default.cyan(retryCommand)}
78097
78545
  `);
78098
78546
  }
78099
78547
  printLegJournal();
78100
78548
  process.exit(1);
78101
78549
  }
78102
78550
  const label = final.status === "rejected" ? "Rejected by user" : final.status === "expired" ? "Expired (TTL elapsed before approval)" : final.status === "failed" ? "The transaction did not land; nothing moved, and the approval window has closed. Re-run the command to propose it again" : `Ended in unexpected status: ${final.status}`;
78103
- process.stderr.write(import_picocolors25.default.red(`\u2715 ${label}.
78551
+ process.stderr.write(import_picocolors26.default.red(`\u2715 ${label}.
78104
78552
  `));
78105
78553
  printLegJournal();
78106
78554
  process.exit(1);
@@ -78120,7 +78568,7 @@ function isAsset(v) {
78120
78568
  return ASSET_VALUES.has(v.toLowerCase());
78121
78569
  }
78122
78570
  function failArg(msg) {
78123
- process.stderr.write(import_picocolors26.default.red(`\u2715 ${msg}
78571
+ process.stderr.write(import_picocolors27.default.red(`\u2715 ${msg}
78124
78572
  `));
78125
78573
  process.exit(2);
78126
78574
  }
@@ -78128,11 +78576,11 @@ async function swap(amount, fromAsset, opts) {
78128
78576
  const requested = opts.profile ?? DEFAULT_PROFILE;
78129
78577
  const resolved = await resolveProfile(requested);
78130
78578
  if (!resolved) {
78131
- process.stderr.write(import_picocolors26.default.red("Not logged in. Run agentgates login first.\n"));
78579
+ process.stderr.write(import_picocolors27.default.red("Not logged in. Run agentgates login first.\n"));
78132
78580
  process.exit(2);
78133
78581
  }
78134
78582
  if (resolved.autoSelected) {
78135
- process.stderr.write(import_picocolors26.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78583
+ process.stderr.write(import_picocolors27.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78136
78584
  `));
78137
78585
  }
78138
78586
  const { profile, name: profileName } = resolved;
@@ -78140,12 +78588,12 @@ async function swap(amount, fromAsset, opts) {
78140
78588
  const jsonMode7 = opts.json === true || !stdoutIsTty;
78141
78589
  const amountNumber = Number(amount);
78142
78590
  if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
78143
- failArg(`amount must be a positive number (got ${import_picocolors26.default.bold(amount)}).`);
78591
+ failArg(`amount must be a positive number (got ${import_picocolors27.default.bold(amount)}).`);
78144
78592
  }
78145
78593
  const fromAssetNorm = fromAsset.toLowerCase();
78146
78594
  if (!isAsset(fromAssetNorm)) {
78147
78595
  failArg(
78148
- `from-asset must be ${import_picocolors26.default.bold("native")} or ${import_picocolors26.default.bold("usdc")} (got ${import_picocolors26.default.bold(fromAsset)}).`
78596
+ `from-asset must be ${import_picocolors27.default.bold("native")} or ${import_picocolors27.default.bold("usdc")} (got ${import_picocolors27.default.bold(fromAsset)}).`
78149
78597
  );
78150
78598
  }
78151
78599
  if (!opts.toAsset) {
@@ -78154,7 +78602,7 @@ async function swap(amount, fromAsset, opts) {
78154
78602
  const toAssetNorm = opts.toAsset.toLowerCase();
78155
78603
  if (!isAsset(toAssetNorm)) {
78156
78604
  failArg(
78157
- `--to-asset must be ${import_picocolors26.default.bold("native")} or ${import_picocolors26.default.bold("usdc")} (got ${import_picocolors26.default.bold(opts.toAsset)}).`
78605
+ `--to-asset must be ${import_picocolors27.default.bold("native")} or ${import_picocolors27.default.bold("usdc")} (got ${import_picocolors27.default.bold(opts.toAsset)}).`
78158
78606
  );
78159
78607
  }
78160
78608
  if (!opts.userStated || opts.userStated.trim() === "") {
@@ -78283,9 +78731,9 @@ async function swap(amount, fromAsset, opts) {
78283
78731
  }
78284
78732
 
78285
78733
  // src/commands/batch.ts
78286
- var import_picocolors27 = __toESM(require_picocolors(), 1);
78734
+ var import_picocolors28 = __toESM(require_picocolors(), 1);
78287
78735
  function failArg2(msg) {
78288
- process.stderr.write(import_picocolors27.default.red(`\u2715 ${msg}
78736
+ process.stderr.write(import_picocolors28.default.red(`\u2715 ${msg}
78289
78737
  `));
78290
78738
  process.exit(2);
78291
78739
  }
@@ -78293,7 +78741,7 @@ async function batch(opts) {
78293
78741
  const requested = opts.profile ?? DEFAULT_PROFILE;
78294
78742
  const resolved = await resolveProfile(requested);
78295
78743
  if (!resolved) {
78296
- process.stderr.write(import_picocolors27.default.red("Not logged in. Run agentgates login first.\n"));
78744
+ process.stderr.write(import_picocolors28.default.red("Not logged in. Run agentgates login first.\n"));
78297
78745
  process.exit(2);
78298
78746
  }
78299
78747
  const { name: profileName, profile } = resolved;
@@ -78347,14 +78795,14 @@ async function batch(opts) {
78347
78795
  }
78348
78796
 
78349
78797
  // src/commands/fund-wallet.ts
78350
- var import_picocolors28 = __toESM(require_picocolors(), 1);
78798
+ var import_picocolors29 = __toESM(require_picocolors(), 1);
78351
78799
  var EVM_ADDRESS_RE2 = /^0x[0-9a-fA-F]{40}$/;
78352
78800
  var SOLANA_ADDRESS_RE2 = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
78353
78801
  function isAddressTarget(target) {
78354
78802
  return EVM_ADDRESS_RE2.test(target) || SOLANA_ADDRESS_RE2.test(target);
78355
78803
  }
78356
78804
  function failArg3(msg) {
78357
- process.stderr.write(import_picocolors28.default.red(`\u2715 ${msg}
78805
+ process.stderr.write(import_picocolors29.default.red(`\u2715 ${msg}
78358
78806
  `));
78359
78807
  process.exit(2);
78360
78808
  }
@@ -78362,7 +78810,7 @@ async function fundWallet(address, opts) {
78362
78810
  const requested = opts.profile ?? DEFAULT_PROFILE;
78363
78811
  const resolved = await resolveProfile(requested);
78364
78812
  if (!resolved) {
78365
- process.stderr.write(import_picocolors28.default.red("Not logged in. Run agentgates login first.\n"));
78813
+ process.stderr.write(import_picocolors29.default.red("Not logged in. Run agentgates login first.\n"));
78366
78814
  process.exit(2);
78367
78815
  }
78368
78816
  const { name: profileName, profile } = resolved;
@@ -78439,11 +78887,11 @@ async function fundWallet(address, opts) {
78439
78887
  }
78440
78888
 
78441
78889
  // src/commands/earn-supply.ts
78442
- var import_picocolors29 = __toESM(require_picocolors(), 1);
78890
+ var import_picocolors30 = __toESM(require_picocolors(), 1);
78443
78891
  var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
78444
78892
  var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
78445
78893
  function failArg4(msg) {
78446
- process.stderr.write(import_picocolors29.default.red(`\u2715 ${msg}
78894
+ process.stderr.write(import_picocolors30.default.red(`\u2715 ${msg}
78447
78895
  `));
78448
78896
  process.exit(2);
78449
78897
  }
@@ -78451,11 +78899,11 @@ async function earnSupply(amount, asset, opts) {
78451
78899
  const requested = opts.profile ?? DEFAULT_PROFILE;
78452
78900
  const resolved = await resolveProfile(requested);
78453
78901
  if (!resolved) {
78454
- process.stderr.write(import_picocolors29.default.red("Not logged in. Run agentgates login first.\n"));
78902
+ process.stderr.write(import_picocolors30.default.red("Not logged in. Run agentgates login first.\n"));
78455
78903
  process.exit(2);
78456
78904
  }
78457
78905
  if (resolved.autoSelected) {
78458
- process.stderr.write(import_picocolors29.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78906
+ process.stderr.write(import_picocolors30.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78459
78907
  `));
78460
78908
  }
78461
78909
  const { profile, name: profileName } = resolved;
@@ -78463,12 +78911,12 @@ async function earnSupply(amount, asset, opts) {
78463
78911
  const jsonMode7 = opts.json === true || !stdoutIsTty;
78464
78912
  const amountNumber = Number(amount);
78465
78913
  if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
78466
- failArg4(`amount must be a positive number (got ${import_picocolors29.default.bold(amount)}).`);
78914
+ failArg4(`amount must be a positive number (got ${import_picocolors30.default.bold(amount)}).`);
78467
78915
  }
78468
78916
  const assetNorm = asset.toLowerCase();
78469
78917
  if (!ASSET_VALUES2.has(assetNorm)) {
78470
78918
  failArg4(
78471
- `asset must be ${import_picocolors29.default.bold("native")} or ${import_picocolors29.default.bold("usdc")} (got ${import_picocolors29.default.bold(asset)}).`
78919
+ `asset must be ${import_picocolors30.default.bold("native")} or ${import_picocolors30.default.bold("usdc")} (got ${import_picocolors30.default.bold(asset)}).`
78472
78920
  );
78473
78921
  }
78474
78922
  if (!opts.chain) {
@@ -78480,7 +78928,7 @@ async function earnSupply(amount, asset, opts) {
78480
78928
  const protocolNorm = opts.protocol.toLowerCase();
78481
78929
  if (!PROTOCOLS.has(protocolNorm)) {
78482
78930
  failArg4(
78483
- `--protocol must be ${import_picocolors29.default.bold("aave_v3")} or ${import_picocolors29.default.bold("kamino_lend")} (got ${import_picocolors29.default.bold(opts.protocol)}).`
78931
+ `--protocol must be ${import_picocolors30.default.bold("aave_v3")} or ${import_picocolors30.default.bold("kamino_lend")} (got ${import_picocolors30.default.bold(opts.protocol)}).`
78484
78932
  );
78485
78933
  }
78486
78934
  if (!opts.userStated || opts.userStated.trim() === "") {
@@ -78532,11 +78980,11 @@ async function earnSupply(amount, asset, opts) {
78532
78980
  }
78533
78981
 
78534
78982
  // src/commands/earn-withdraw.ts
78535
- var import_picocolors30 = __toESM(require_picocolors(), 1);
78983
+ var import_picocolors31 = __toESM(require_picocolors(), 1);
78536
78984
  var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
78537
78985
  var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
78538
78986
  function failArg5(msg) {
78539
- process.stderr.write(import_picocolors30.default.red(`\u2715 ${msg}
78987
+ process.stderr.write(import_picocolors31.default.red(`\u2715 ${msg}
78540
78988
  `));
78541
78989
  process.exit(2);
78542
78990
  }
@@ -78544,11 +78992,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
78544
78992
  const requested = opts.profile ?? DEFAULT_PROFILE;
78545
78993
  const resolved = await resolveProfile(requested);
78546
78994
  if (!resolved) {
78547
- process.stderr.write(import_picocolors30.default.red("Not logged in. Run agentgates login first.\n"));
78995
+ process.stderr.write(import_picocolors31.default.red("Not logged in. Run agentgates login first.\n"));
78548
78996
  process.exit(2);
78549
78997
  }
78550
78998
  if (resolved.autoSelected) {
78551
- process.stderr.write(import_picocolors30.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78999
+ process.stderr.write(import_picocolors31.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78552
79000
  `));
78553
79001
  }
78554
79002
  const { profile, name: profileName } = resolved;
@@ -78559,14 +79007,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
78559
79007
  const amountNumber = Number(amountOrMax);
78560
79008
  if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
78561
79009
  failArg5(
78562
- `<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors30.default.bold(amountOrMax)}).`
79010
+ `<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors31.default.bold(amountOrMax)}).`
78563
79011
  );
78564
79012
  }
78565
79013
  }
78566
79014
  const assetNorm = asset.toLowerCase();
78567
79015
  if (!ASSET_VALUES3.has(assetNorm)) {
78568
79016
  failArg5(
78569
- `asset must be ${import_picocolors30.default.bold("native")} or ${import_picocolors30.default.bold("usdc")} (got ${import_picocolors30.default.bold(asset)}).`
79017
+ `asset must be ${import_picocolors31.default.bold("native")} or ${import_picocolors31.default.bold("usdc")} (got ${import_picocolors31.default.bold(asset)}).`
78570
79018
  );
78571
79019
  }
78572
79020
  if (!opts.chain) {
@@ -78578,7 +79026,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
78578
79026
  const protocolNorm = opts.protocol.toLowerCase();
78579
79027
  if (!PROTOCOLS2.has(protocolNorm)) {
78580
79028
  failArg5(
78581
- `--protocol must be ${import_picocolors30.default.bold("aave_v3")} or ${import_picocolors30.default.bold("kamino_lend")} (got ${import_picocolors30.default.bold(opts.protocol)}).`
79029
+ `--protocol must be ${import_picocolors31.default.bold("aave_v3")} or ${import_picocolors31.default.bold("kamino_lend")} (got ${import_picocolors31.default.bold(opts.protocol)}).`
78582
79030
  );
78583
79031
  }
78584
79032
  if (!opts.userStated || opts.userStated.trim() === "") {
@@ -78630,7 +79078,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
78630
79078
  }
78631
79079
 
78632
79080
  // src/commands/eat.ts
78633
- var import_picocolors31 = __toESM(require_picocolors(), 1);
79081
+ var import_picocolors32 = __toESM(require_picocolors(), 1);
78634
79082
  function parseLineJson(values) {
78635
79083
  const lines = [];
78636
79084
  for (const value of values) {
@@ -78657,11 +79105,11 @@ function parseLineJson(values) {
78657
79105
  async function loadResolvedProfile(requested) {
78658
79106
  const resolved = await resolveProfile(requested);
78659
79107
  if (!resolved) {
78660
- process.stderr.write(import_picocolors31.default.red("Not logged in. Run agentgates login first.\n"));
79108
+ process.stderr.write(import_picocolors32.default.red("Not logged in. Run agentgates login first.\n"));
78661
79109
  process.exit(2);
78662
79110
  }
78663
79111
  if (resolved.autoSelected) {
78664
- process.stderr.write(import_picocolors31.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79112
+ process.stderr.write(import_picocolors32.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78665
79113
  `));
78666
79114
  }
78667
79115
  return resolved;
@@ -78672,12 +79120,12 @@ function printResult(res, jsonMode7) {
78672
79120
  return;
78673
79121
  }
78674
79122
  if (res.blocked) {
78675
- process.stderr.write(import_picocolors31.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
79123
+ process.stderr.write(import_picocolors32.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
78676
79124
  `));
78677
79125
  if (res.upgrade_url) {
78678
79126
  process.stderr.write(
78679
79127
  ` Open this to grant access, then re-run the command:
78680
- ${import_picocolors31.default.cyan(res.upgrade_url)}
79128
+ ${import_picocolors32.default.cyan(res.upgrade_url)}
78681
79129
  `
78682
79130
  );
78683
79131
  }
@@ -78708,7 +79156,7 @@ async function postRestaurant(path8, body, resolved, jsonMode7) {
78708
79156
  profile: resolved.profile,
78709
79157
  profileName: resolved.name,
78710
79158
  jsonMode: jsonMode7,
78711
- ttyHeader: import_picocolors31.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79159
+ ttyHeader: import_picocolors32.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
78712
79160
  fn: (bearer, origin) => apiFetch(path8, { method: "POST", bearer, origin, body })
78713
79161
  });
78714
79162
  if (outcome.kind === "auth_failed") {
@@ -78718,7 +79166,7 @@ async function postRestaurant(path8, body, resolved, jsonMode7) {
78718
79166
  );
78719
79167
  process.exit(1);
78720
79168
  }
78721
- process.stderr.write(import_picocolors31.default.red(`\u2715 ${outcome.reason}.
79169
+ process.stderr.write(import_picocolors32.default.red(`\u2715 ${outcome.reason}.
78722
79170
  `));
78723
79171
  process.exit(1);
78724
79172
  }
@@ -78731,7 +79179,7 @@ async function postRestaurant(path8, body, resolved, jsonMode7) {
78731
79179
  );
78732
79180
  process.exit(1);
78733
79181
  }
78734
- process.stderr.write(import_picocolors31.default.red(`\u2715 ${err.message} (HTTP ${err.status})
79182
+ process.stderr.write(import_picocolors32.default.red(`\u2715 ${err.message} (HTTP ${err.status})
78735
79183
  `));
78736
79184
  process.exit(1);
78737
79185
  }
@@ -78744,7 +79192,7 @@ async function searchFood(opts) {
78744
79192
  const jsonMode7 = opts.json === true || process.stdout.isTTY !== true;
78745
79193
  if (!opts.location && !opts.name) {
78746
79194
  process.stderr.write(
78747
- import_picocolors31.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
79195
+ import_picocolors32.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
78748
79196
  );
78749
79197
  process.exit(2);
78750
79198
  }
@@ -78765,7 +79213,7 @@ async function menuFood(items, opts) {
78765
79213
  const jsonMode7 = opts.json === true || process.stdout.isTTY !== true;
78766
79214
  if (!opts.brand || !opts.address) {
78767
79215
  process.stderr.write(
78768
- import_picocolors31.default.red(
79216
+ import_picocolors32.default.red(
78769
79217
  "\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
78770
79218
  )
78771
79219
  );
@@ -78785,7 +79233,7 @@ async function orderFood(items, opts) {
78785
79233
  const jsonMode7 = opts.json === true || process.stdout.isTTY !== true;
78786
79234
  if (!opts.brand || !opts.address) {
78787
79235
  process.stderr.write(
78788
- import_picocolors31.default.red(
79236
+ import_picocolors32.default.red(
78789
79237
  "\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
78790
79238
  )
78791
79239
  );
@@ -78795,14 +79243,14 @@ async function orderFood(items, opts) {
78795
79243
  try {
78796
79244
  structuredLines = parseLineJson(opts.lineJson ?? []);
78797
79245
  } catch (e) {
78798
- process.stderr.write(import_picocolors31.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
79246
+ process.stderr.write(import_picocolors32.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
78799
79247
  `));
78800
79248
  process.exit(2);
78801
79249
  }
78802
79250
  const lines = [...items ?? [], ...structuredLines];
78803
79251
  if (lines.length === 0) {
78804
79252
  process.stderr.write(
78805
- import_picocolors31.default.red("\u2715 Pass at least one dish \u2014 plain words as arguments, or --line-json for a line with a size/option/note.\n")
79253
+ import_picocolors32.default.red("\u2715 Pass at least one dish \u2014 plain words as arguments, or --line-json for a line with a size/option/note.\n")
78806
79254
  );
78807
79255
  process.exit(2);
78808
79256
  }
@@ -78836,7 +79284,7 @@ async function orderFood(items, opts) {
78836
79284
  if (!agentCard.will_attempt) {
78837
79285
  if (!jsonMode7) {
78838
79286
  process.stderr.write(
78839
- import_picocolors31.default.yellow(
79287
+ import_picocolors32.default.yellow(
78840
79288
  `This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
78841
79289
  `
78842
79290
  )
@@ -78853,7 +79301,7 @@ async function orderFood(items, opts) {
78853
79301
  }
78854
79302
  if (verdict.status === "paid") {
78855
79303
  process.stdout.write(
78856
- import_picocolors31.default.green(
79304
+ import_picocolors32.default.green(
78857
79305
  `Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
78858
79306
  )
78859
79307
  );
@@ -78861,7 +79309,7 @@ async function orderFood(items, opts) {
78861
79309
  }
78862
79310
  if (verdict.status === "failed") {
78863
79311
  process.stderr.write(
78864
- import_picocolors31.default.yellow(
79312
+ import_picocolors32.default.yellow(
78865
79313
  `Your saved card did not pay this (${verdict.failure_reason ?? "refused"}${verdict.failure_detail ? `: ${verdict.failure_detail}` : ""}). Nothing was charged. The link still works for you to pay yourself.
78866
79314
  `
78867
79315
  )
@@ -78871,7 +79319,7 @@ async function orderFood(items, opts) {
78871
79319
  }
78872
79320
  if (verdict.status === "unconfirmed") {
78873
79321
  process.stderr.write(
78874
- import_picocolors31.default.red(
79322
+ import_picocolors32.default.red(
78875
79323
  "A payment attempt happened and its outcome is UNKNOWN \u2014 nothing will retry it. Open the order and check before paying anything:\n" + (approvalUrl ? ` ${approvalUrl}
78876
79324
  ` : "")
78877
79325
  )
@@ -78880,7 +79328,7 @@ async function orderFood(items, opts) {
78880
79328
  return;
78881
79329
  }
78882
79330
  process.stderr.write(
78883
- import_picocolors31.default.dim(
79331
+ import_picocolors32.default.dim(
78884
79332
  `Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
78885
79333
  )
78886
79334
  );
@@ -78905,7 +79353,7 @@ var POLL_BUDGET_MS = 1e5;
78905
79353
  var POLL_INTERVAL_MS2 = 3500;
78906
79354
  async function pollOrderVerdict(orderId, resolved, jsonMode7) {
78907
79355
  if (!jsonMode7) {
78908
- process.stderr.write(import_picocolors31.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
79356
+ process.stderr.write(import_picocolors32.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
78909
79357
  }
78910
79358
  const deadline = Date.now() + POLL_BUDGET_MS;
78911
79359
  let last = {
@@ -78975,17 +79423,17 @@ async function statusFood(orderId, opts) {
78975
79423
  }
78976
79424
 
78977
79425
  // src/commands/bounties.ts
78978
- var import_picocolors32 = __toESM(require_picocolors(), 1);
79426
+ var import_picocolors33 = __toESM(require_picocolors(), 1);
78979
79427
  init_constants();
78980
79428
  async function withProfile(opts, path8, init2) {
78981
79429
  const requested = opts.profile ?? DEFAULT_PROFILE;
78982
79430
  const resolved = await resolveProfile(requested);
78983
79431
  if (!resolved) {
78984
- process.stderr.write(import_picocolors32.default.red("Not logged in. Run agentgates login first.\n"));
79432
+ process.stderr.write(import_picocolors33.default.red("Not logged in. Run agentgates login first.\n"));
78985
79433
  process.exit(2);
78986
79434
  }
78987
79435
  if (resolved.autoSelected) {
78988
- process.stderr.write(import_picocolors32.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79436
+ process.stderr.write(import_picocolors33.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
78989
79437
  `));
78990
79438
  }
78991
79439
  const { profile, name: profileName } = resolved;
@@ -78994,7 +79442,7 @@ async function withProfile(opts, path8, init2) {
78994
79442
  profile,
78995
79443
  profileName,
78996
79444
  jsonMode: jsonMode7,
78997
- ttyHeader: import_picocolors32.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79445
+ ttyHeader: import_picocolors33.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
78998
79446
  fn: (bearer, origin) => apiFetch(path8, init2 ? { bearer, origin, method: init2.method, body: init2.body } : { bearer, origin })
78999
79447
  });
79000
79448
  if (outcome.kind === "auth_failed") {
@@ -79002,14 +79450,14 @@ async function withProfile(opts, path8, init2) {
79002
79450
  process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
79003
79451
  process.exit(1);
79004
79452
  }
79005
- process.stderr.write(import_picocolors32.default.red(`\u2715 ${outcome.reason}.
79453
+ process.stderr.write(import_picocolors33.default.red(`\u2715 ${outcome.reason}.
79006
79454
  `));
79007
79455
  process.exit(1);
79008
79456
  }
79009
79457
  if (outcome.kind === "error") {
79010
79458
  const err = outcome.error;
79011
79459
  if (err instanceof ApiError) {
79012
- process.stderr.write(import_picocolors32.default.red(`\u2715 ${err.message} (HTTP ${err.status})
79460
+ process.stderr.write(import_picocolors33.default.red(`\u2715 ${err.message} (HTTP ${err.status})
79013
79461
  `));
79014
79462
  process.exit(1);
79015
79463
  }
@@ -79023,12 +79471,12 @@ function handleBlocked(res, jsonMode7) {
79023
79471
  process.stdout.write(JSON.stringify(res, null, 2) + "\n");
79024
79472
  process.exit(1);
79025
79473
  }
79026
- process.stderr.write(import_picocolors32.default.yellow(`
79474
+ process.stderr.write(import_picocolors33.default.yellow(`
79027
79475
  ${res.reason ?? "Blocked."}
79028
79476
  `));
79029
79477
  if (res.upgrade_url) {
79030
79478
  process.stderr.write(`
79031
- ${import_picocolors32.default.bold(res.upgrade_url)}
79479
+ ${import_picocolors33.default.bold(res.upgrade_url)}
79032
79480
 
79033
79481
  `);
79034
79482
  }
@@ -79071,14 +79519,14 @@ function printTable(rows) {
79071
79519
  const cLeft = w("left", 4);
79072
79520
  const cSubs = w("subs", 4);
79073
79521
  process.stdout.write(
79074
- import_picocolors32.default.dim(
79522
+ import_picocolors33.default.dim(
79075
79523
  "Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
79076
79524
  ) + "\n"
79077
79525
  );
79078
79526
  for (const c of cells) {
79079
- const title = c.live ? import_picocolors32.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
79527
+ const title = c.live ? import_picocolors33.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
79080
79528
  process.stdout.write(
79081
- import_picocolors32.default.bold(c.amount.padStart(cAmount)) + " " + title + " " + c.chain.padEnd(cChain) + " " + c.ev.padEnd(cEv) + " " + c.left.padStart(cLeft) + " " + c.subs.padStart(cSubs) + " " + import_picocolors32.default.dim(c.id) + "\n"
79529
+ import_picocolors33.default.bold(c.amount.padStart(cAmount)) + " " + title + " " + c.chain.padEnd(cChain) + " " + c.ev.padEnd(cEv) + " " + c.left.padStart(cLeft) + " " + c.subs.padStart(cSubs) + " " + import_picocolors33.default.dim(c.id) + "\n"
79082
79530
  );
79083
79531
  }
79084
79532
  }
@@ -79090,11 +79538,11 @@ async function listBounties(opts) {
79090
79538
  const min = opts.min !== void 0 ? Number(opts.min) : void 0;
79091
79539
  const max = opts.max !== void 0 ? Number(opts.max) : void 0;
79092
79540
  if (min !== void 0 && !Number.isFinite(min)) {
79093
- process.stderr.write(import_picocolors32.default.red("\u2715 --min must be a number.\n"));
79541
+ process.stderr.write(import_picocolors33.default.red("\u2715 --min must be a number.\n"));
79094
79542
  process.exit(2);
79095
79543
  }
79096
79544
  if (max !== void 0 && !Number.isFinite(max)) {
79097
- process.stderr.write(import_picocolors32.default.red("\u2715 --max must be a number.\n"));
79545
+ process.stderr.write(import_picocolors33.default.red("\u2715 --max must be a number.\n"));
79098
79546
  process.exit(2);
79099
79547
  }
79100
79548
  rows = rows.filter((r) => {
@@ -79119,7 +79567,7 @@ async function listBounties(opts) {
79119
79567
  });
79120
79568
  const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
79121
79569
  if (!Number.isFinite(limit) || limit <= 0) {
79122
- process.stderr.write(import_picocolors32.default.red("\u2715 --limit must be a positive number.\n"));
79570
+ process.stderr.write(import_picocolors33.default.red("\u2715 --limit must be a positive number.\n"));
79123
79571
  process.exit(2);
79124
79572
  }
79125
79573
  const shown2 = rows.slice(0, limit);
@@ -79128,13 +79576,13 @@ async function listBounties(opts) {
79128
79576
  return;
79129
79577
  }
79130
79578
  if (shown2.length === 0) {
79131
- process.stdout.write(import_picocolors32.default.dim("No active bounties match.\n"));
79579
+ process.stdout.write(import_picocolors33.default.dim("No active bounties match.\n"));
79132
79580
  return;
79133
79581
  }
79134
79582
  printTable(shown2);
79135
79583
  const clipped = rows.length - shown2.length;
79136
79584
  process.stdout.write(
79137
- "\n" + import_picocolors32.default.dim(
79585
+ "\n" + import_picocolors33.default.dim(
79138
79586
  `${shown2.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
79139
79587
  `
79140
79588
  )
@@ -79145,7 +79593,7 @@ async function showBounty(id2, opts) {
79145
79593
  const jsonMode7 = opts.json === true;
79146
79594
  const clean3 = id2.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
79147
79595
  if (!clean3) {
79148
- process.stderr.write(import_picocolors32.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
79596
+ process.stderr.write(import_picocolors33.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
79149
79597
  process.exit(2);
79150
79598
  }
79151
79599
  const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean3)}`);
@@ -79156,26 +79604,26 @@ async function showBounty(id2, opts) {
79156
79604
  }
79157
79605
  const b2 = res.bounty;
79158
79606
  if (!b2) {
79159
- process.stdout.write(import_picocolors32.default.dim("Not found.\n"));
79607
+ process.stdout.write(import_picocolors33.default.dim("Not found.\n"));
79160
79608
  return;
79161
79609
  }
79162
- process.stdout.write("\n" + import_picocolors32.default.bold(b2.title) + "\n\n");
79610
+ process.stdout.write("\n" + import_picocolors33.default.bold(b2.title) + "\n\n");
79163
79611
  process.stdout.write(b2.description + "\n\n");
79164
79612
  process.stdout.write(
79165
- import_picocolors32.default.bold(fmtAmount(b2.amount)) + import_picocolors32.default.dim(" USDC") + import_picocolors32.default.dim(` \xB7 ${chainOf2(b2)} \xB7 ${b2.status.toLowerCase()}`) + (b2.liveNow ? import_picocolors32.default.green(" \xB7 LIVE now") : "") + "\n"
79613
+ import_picocolors33.default.bold(fmtAmount(b2.amount)) + import_picocolors33.default.dim(" USDC") + import_picocolors33.default.dim(` \xB7 ${chainOf2(b2)} \xB7 ${b2.status.toLowerCase()}`) + (b2.liveNow ? import_picocolors33.default.green(" \xB7 LIVE now") : "") + "\n"
79166
79614
  );
79167
79615
  if (b2.claimsAllowed && b2.claimsAllowed > 1) {
79168
79616
  const left = Math.max(0, b2.claimsAllowed - (b2.claimsPaid ?? 0));
79169
79617
  process.stdout.write(
79170
- import_picocolors32.default.dim(
79618
+ import_picocolors33.default.dim(
79171
79619
  `${left} of ${b2.claimsAllowed} claims left` + (b2.perClaimAmount != null ? `, ${fmtAmount(b2.perClaimAmount)} each` : "")
79172
79620
  ) + "\n"
79173
79621
  );
79174
79622
  }
79175
- if (b2.evidenceType) process.stdout.write(import_picocolors32.default.dim(`Evidence required: ${b2.evidenceType}`) + "\n");
79176
- if (b2.expiresAt) process.stdout.write(import_picocolors32.default.dim(`Expires in ${fmtExpiry(b2.expiresAt)}`) + "\n");
79623
+ if (b2.evidenceType) process.stdout.write(import_picocolors33.default.dim(`Evidence required: ${b2.evidenceType}`) + "\n");
79624
+ if (b2.expiresAt) process.stdout.write(import_picocolors33.default.dim(`Expires in ${fmtExpiry(b2.expiresAt)}`) + "\n");
79177
79625
  if (b2.geoLabel && b2.geoScope !== "global") {
79178
- process.stdout.write(import_picocolors32.default.dim(`Creator says: ${b2.geoLabel}`) + "\n");
79626
+ process.stdout.write(import_picocolors33.default.dim(`Creator says: ${b2.geoLabel}`) + "\n");
79179
79627
  }
79180
79628
  if (res.url) process.stdout.write("\n" + res.url + "\n");
79181
79629
  process.stdout.write(AI_DIRECTIVE + "\n");
@@ -79193,7 +79641,7 @@ async function myBounties(opts) {
79193
79641
  }
79194
79642
  if (rows.length === 0) {
79195
79643
  process.stdout.write(
79196
- import_picocolors32.default.dim(
79644
+ import_picocolors33.default.dim(
79197
79645
  status4 ? `No bounties of yours are ${status4}.
79198
79646
  ` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
79199
79647
  )
@@ -79203,7 +79651,7 @@ async function myBounties(opts) {
79203
79651
  printTable(rows);
79204
79652
  const subs = res.submissions ?? [];
79205
79653
  if (subs.length > 0) {
79206
- process.stdout.write("\n" + import_picocolors32.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
79654
+ process.stdout.write("\n" + import_picocolors33.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
79207
79655
  `));
79208
79656
  }
79209
79657
  process.stdout.write(AI_DIRECTIVE + "\n");
@@ -79222,19 +79670,19 @@ async function bountyFeed(opts) {
79222
79670
  }
79223
79671
  const subs = res.submissions ?? [];
79224
79672
  if (subs.length === 0) {
79225
- process.stdout.write(import_picocolors32.default.dim("Nothing in the feed for that filter.\n"));
79673
+ process.stdout.write(import_picocolors33.default.dim("Nothing in the feed for that filter.\n"));
79226
79674
  return;
79227
79675
  }
79228
79676
  process.stdout.write(
79229
- `${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors32.default.dim(" More available.") : "") + "\n"
79677
+ `${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors33.default.dim(" More available.") : "") + "\n"
79230
79678
  );
79231
- process.stdout.write(import_picocolors32.default.dim("Use --json for the full rows.\n"));
79679
+ process.stdout.write(import_picocolors33.default.dim("Use --json for the full rows.\n"));
79232
79680
  }
79233
79681
  async function draftBounty(opts) {
79234
79682
  const jsonMode7 = opts.json === true;
79235
79683
  const amountNum = Number(opts.amount);
79236
79684
  if (!Number.isFinite(amountNum) || amountNum <= 0) {
79237
- process.stderr.write(import_picocolors32.default.red("\u2715 --amount must be a positive number of USDC.\n"));
79685
+ process.stderr.write(import_picocolors33.default.red("\u2715 --amount must be a positive number of USDC.\n"));
79238
79686
  process.exit(2);
79239
79687
  }
79240
79688
  const res = await withProfile(opts, "/api/bounties", {
@@ -79252,20 +79700,20 @@ async function draftBounty(opts) {
79252
79700
  process.stdout.write(JSON.stringify(res, null, 2) + "\n");
79253
79701
  return;
79254
79702
  }
79255
- process.stdout.write("\n" + import_picocolors32.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
79703
+ process.stdout.write("\n" + import_picocolors33.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
79256
79704
 
79257
79705
  `);
79258
- process.stdout.write(import_picocolors32.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
79706
+ process.stdout.write(import_picocolors33.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
79259
79707
  if (res.fund_url) {
79260
- process.stdout.write("\nFund it here:\n" + import_picocolors32.default.bold(res.fund_url) + "\n\n");
79261
- process.stdout.write(import_picocolors32.default.dim("Funding happens in your browser with your own wallet.\n"));
79708
+ process.stdout.write("\nFund it here:\n" + import_picocolors33.default.bold(res.fund_url) + "\n\n");
79709
+ process.stdout.write(import_picocolors33.default.dim("Funding happens in your browser with your own wallet.\n"));
79262
79710
  }
79263
79711
  }
79264
79712
 
79265
79713
  // src/commands/bounty-money.ts
79266
- var import_picocolors33 = __toESM(require_picocolors(), 1);
79714
+ var import_picocolors34 = __toESM(require_picocolors(), 1);
79267
79715
  function failArg6(message) {
79268
- process.stderr.write(import_picocolors33.default.red(`${message}
79716
+ process.stderr.write(import_picocolors34.default.red(`${message}
79269
79717
  `));
79270
79718
  process.exit(2);
79271
79719
  }
@@ -79277,12 +79725,12 @@ async function loadProfileOrExit(requested, jsonMode7) {
79277
79725
  JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
79278
79726
  );
79279
79727
  } else {
79280
- process.stderr.write(import_picocolors33.default.red("Not logged in. Run agentgates login first.\n"));
79728
+ process.stderr.write(import_picocolors34.default.red("Not logged in. Run agentgates login first.\n"));
79281
79729
  }
79282
79730
  process.exit(2);
79283
79731
  }
79284
79732
  if (resolved.autoSelected && !jsonMode7) {
79285
- process.stderr.write(import_picocolors33.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79733
+ process.stderr.write(import_picocolors34.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79286
79734
  `));
79287
79735
  }
79288
79736
  return { profile: resolved.profile, profileName: resolved.name };
@@ -79387,17 +79835,17 @@ async function subscribeCreator(creatorUserId, opts) {
79387
79835
  }
79388
79836
 
79389
79837
  // src/commands/bounty-work.ts
79390
- var import_picocolors34 = __toESM(require_picocolors(), 1);
79838
+ var import_picocolors35 = __toESM(require_picocolors(), 1);
79391
79839
  init_constants();
79392
79840
  async function runWork(path8, body, opts) {
79393
79841
  const requested = opts.profile ?? DEFAULT_PROFILE;
79394
79842
  const resolved = await resolveProfile(requested);
79395
79843
  if (!resolved) {
79396
- process.stderr.write(import_picocolors34.default.red("Not logged in. Run agentgates login first.\n"));
79844
+ process.stderr.write(import_picocolors35.default.red("Not logged in. Run agentgates login first.\n"));
79397
79845
  process.exit(2);
79398
79846
  }
79399
79847
  if (resolved.autoSelected) {
79400
- process.stderr.write(import_picocolors34.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79848
+ process.stderr.write(import_picocolors35.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79401
79849
  `));
79402
79850
  }
79403
79851
  const jsonMode7 = opts.json === true;
@@ -79405,7 +79853,7 @@ async function runWork(path8, body, opts) {
79405
79853
  profile: resolved.profile,
79406
79854
  profileName: resolved.name,
79407
79855
  jsonMode: jsonMode7,
79408
- ttyHeader: import_picocolors34.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79856
+ ttyHeader: import_picocolors35.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79409
79857
  fn: (bearer, origin) => apiFetch(path8, { bearer, origin, method: "POST", body })
79410
79858
  });
79411
79859
  if (outcome.kind === "auth_failed") {
@@ -79413,7 +79861,7 @@ async function runWork(path8, body, opts) {
79413
79861
  process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
79414
79862
  process.exit(1);
79415
79863
  }
79416
- process.stderr.write(import_picocolors34.default.red(`\u2715 ${outcome.reason}.
79864
+ process.stderr.write(import_picocolors35.default.red(`\u2715 ${outcome.reason}.
79417
79865
  `));
79418
79866
  process.exit(1);
79419
79867
  }
@@ -79423,7 +79871,7 @@ async function runWork(path8, body, opts) {
79423
79871
  if (jsonMode7) {
79424
79872
  process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
79425
79873
  } else {
79426
- process.stderr.write(import_picocolors34.default.red(`\u2715 ${err.message} (HTTP ${err.status})
79874
+ process.stderr.write(import_picocolors35.default.red(`\u2715 ${err.message} (HTTP ${err.status})
79427
79875
  `));
79428
79876
  }
79429
79877
  process.exit(1);
@@ -79436,11 +79884,11 @@ async function runWork(path8, body, opts) {
79436
79884
  process.stdout.write(JSON.stringify({ ok: false, ...data4 }) + "\n");
79437
79885
  process.exit(1);
79438
79886
  }
79439
- process.stderr.write(import_picocolors34.default.yellow(`
79887
+ process.stderr.write(import_picocolors35.default.yellow(`
79440
79888
  ${data4.reason ?? "Blocked."}
79441
79889
  `));
79442
79890
  if (data4.upgrade_url) process.stderr.write(`
79443
- ${import_picocolors34.default.bold(data4.upgrade_url)}
79891
+ ${import_picocolors35.default.bold(data4.upgrade_url)}
79444
79892
 
79445
79893
  `);
79446
79894
  process.exit(1);
@@ -79449,7 +79897,7 @@ ${import_picocolors34.default.bold(data4.upgrade_url)}
79449
79897
  if (jsonMode7) {
79450
79898
  process.stdout.write(JSON.stringify({ ok: false, error: data4.error }) + "\n");
79451
79899
  } else {
79452
- process.stderr.write(import_picocolors34.default.red(`\u2715 ${data4.error}
79900
+ process.stderr.write(import_picocolors35.default.red(`\u2715 ${data4.error}
79453
79901
  `));
79454
79902
  }
79455
79903
  process.exit(1);
@@ -79492,7 +79940,7 @@ async function bountyRetention(bountyId, opts) {
79492
79940
  }
79493
79941
 
79494
79942
  // src/commands/bounty-deliver.ts
79495
- var import_picocolors35 = __toESM(require_picocolors(), 1);
79943
+ var import_picocolors36 = __toESM(require_picocolors(), 1);
79496
79944
  import { spawn as spawn2 } from "node:child_process";
79497
79945
  init_constants();
79498
79946
  var FLUSH_MS = 400;
@@ -79502,11 +79950,11 @@ async function deliver(bountyId, command, opts) {
79502
79950
  const requested = opts.profile ?? DEFAULT_PROFILE;
79503
79951
  const resolved = await resolveProfile(requested);
79504
79952
  if (!resolved) {
79505
- process.stderr.write(import_picocolors35.default.red("Not logged in. Run agentgates login first.\n"));
79953
+ process.stderr.write(import_picocolors36.default.red("Not logged in. Run agentgates login first.\n"));
79506
79954
  process.exit(2);
79507
79955
  }
79508
79956
  if (resolved.autoSelected && !jsonMode7) {
79509
- process.stderr.write(import_picocolors35.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79957
+ process.stderr.write(import_picocolors36.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
79510
79958
  `));
79511
79959
  }
79512
79960
  const post3 = async (path8, body) => {
@@ -79514,7 +79962,7 @@ async function deliver(bountyId, command, opts) {
79514
79962
  profile: resolved.profile,
79515
79963
  profileName: resolved.name,
79516
79964
  jsonMode: jsonMode7,
79517
- ttyHeader: import_picocolors35.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79965
+ ttyHeader: import_picocolors36.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
79518
79966
  fn: (bearer, origin) => apiFetch(path8, { bearer, origin, method: "POST", body })
79519
79967
  });
79520
79968
  if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
@@ -79525,11 +79973,11 @@ async function deliver(bountyId, command, opts) {
79525
79973
  if (jsonMode7) {
79526
79974
  process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data4 ?? {} }) + "\n");
79527
79975
  } else {
79528
- process.stderr.write(import_picocolors35.default.red(`
79976
+ process.stderr.write(import_picocolors36.default.red(`
79529
79977
  \u2715 ${msg}
79530
79978
  `));
79531
79979
  if (data4?.upgrade_url) process.stderr.write(`
79532
- ${import_picocolors35.default.bold(data4.upgrade_url)}
79980
+ ${import_picocolors36.default.bold(data4.upgrade_url)}
79533
79981
 
79534
79982
  `);
79535
79983
  }
@@ -79554,7 +80002,7 @@ ${import_picocolors35.default.bold(data4.upgrade_url)}
79554
80002
  if (!runId) return void die("The service opened a run but did not name it.");
79555
80003
  if (!jsonMode7) {
79556
80004
  process.stderr.write(
79557
- import_picocolors35.default.bold("\n\u25CF LIVE ") + import_picocolors35.default.dim("everything below is going onto the bounty page as it happens\n") + import_picocolors35.default.dim(` ${started.url ?? ""}
80005
+ import_picocolors36.default.bold("\n\u25CF LIVE ") + import_picocolors36.default.dim("everything below is going onto the bounty page as it happens\n") + import_picocolors36.default.dim(` ${started.url ?? ""}
79558
80006
 
79559
80007
  `)
79560
80008
  );
@@ -79606,10 +80054,10 @@ ${import_picocolors35.default.bold(data4.upgrade_url)}
79606
80054
  child.stdout.on("data", (d) => consume(d));
79607
80055
  child.stderr.setEncoding("utf8");
79608
80056
  child.stderr.on("data", (d) => {
79609
- if (!jsonMode7) process.stderr.write(import_picocolors35.default.dim(d));
80057
+ if (!jsonMode7) process.stderr.write(import_picocolors36.default.dim(d));
79610
80058
  });
79611
80059
  child.on("error", (err) => {
79612
- process.stderr.write(import_picocolors35.default.red(`
80060
+ process.stderr.write(import_picocolors36.default.red(`
79613
80061
  \u2715 Could not run ${command[0]}: ${err.message}
79614
80062
  `));
79615
80063
  resolve3(127);
@@ -79646,14 +80094,14 @@ ${import_picocolors35.default.bold(data4.upgrade_url)}
79646
80094
  }
79647
80095
  if (appendFailure) {
79648
80096
  process.stderr.write(
79649
- import_picocolors35.default.yellow(`
80097
+ import_picocolors36.default.yellow(`
79650
80098
  ! Some output did not reach the page: ${appendFailure}
79651
- `) + import_picocolors35.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
80099
+ `) + import_picocolors36.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
79652
80100
  );
79653
80101
  }
79654
80102
  if (exitCode) {
79655
80103
  process.stderr.write(
79656
- import_picocolors35.default.yellow(`
80104
+ import_picocolors36.default.yellow(`
79657
80105
  ! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
79658
80106
  `)
79659
80107
  );
@@ -79663,7 +80111,7 @@ ${import_picocolors35.default.bold(data4.upgrade_url)}
79663
80111
  }
79664
80112
 
79665
80113
  // src/commands/trade.ts
79666
- var import_picocolors36 = __toESM(require_picocolors(), 1);
80114
+ var import_picocolors37 = __toESM(require_picocolors(), 1);
79667
80115
  init_constants();
79668
80116
 
79669
80117
  // src/lib/trade-sol.ts
@@ -80027,11 +80475,11 @@ async function runTrade(args) {
80027
80475
  }
80028
80476
 
80029
80477
  // src/commands/trade.ts
80030
- function fail7(message, json2) {
80478
+ function fail8(message, json2) {
80031
80479
  if (json2) {
80032
80480
  process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
80033
80481
  } else {
80034
- process.stderr.write(import_picocolors36.default.red(`\u2715 ${message}
80482
+ process.stderr.write(import_picocolors37.default.red(`\u2715 ${message}
80035
80483
  `));
80036
80484
  }
80037
80485
  process.exit(1);
@@ -80041,7 +80489,7 @@ async function withContext(opts, fn) {
80041
80489
  const ctx2 = await resolveTradeContext();
80042
80490
  return await fn(ctx2);
80043
80491
  } catch (err) {
80044
- fail7(err.message, opts.json);
80492
+ fail8(err.message, opts.json);
80045
80493
  }
80046
80494
  }
80047
80495
  function servedFloorUnits(ctx2) {
@@ -80067,7 +80515,7 @@ async function tradeKey(opts) {
80067
80515
  ];
80068
80516
  process.stdout.write(lines.join("\n") + "\n" + AI_DIRECTIVE + "\n");
80069
80517
  } catch (err) {
80070
- fail7(err.message, opts.json);
80518
+ fail8(err.message, opts.json);
80071
80519
  }
80072
80520
  }
80073
80521
  async function tradeStatus(opts) {
@@ -80124,7 +80572,7 @@ async function tradeQuote(coinArg, amount, opts) {
80124
80572
  const coin = await resolveCoin(coinArg);
80125
80573
  const amountNumber = Number(amount);
80126
80574
  if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
80127
- fail7(`Amount "${amount}" is not a positive number.`, opts.json);
80575
+ fail8(`Amount "${amount}" is not a positive number.`, opts.json);
80128
80576
  }
80129
80577
  const res = await fetch(`${CREATORS_ORIGIN}/api/launch-quote`, {
80130
80578
  method: "POST",
@@ -80138,7 +80586,7 @@ async function tradeQuote(coinArg, amount, opts) {
80138
80586
  });
80139
80587
  const body = await res.json().catch(() => null);
80140
80588
  if (!res.ok || !body) {
80141
- fail7(`Quote failed: ${body?.error ?? `HTTP ${res.status}`}`, opts.json);
80589
+ fail8(`Quote failed: ${body?.error ?? `HTTP ${res.status}`}`, opts.json);
80142
80590
  }
80143
80591
  const floor = servedFloorUnits(ctx2);
80144
80592
  const belowFloor = side === "buy" && floor !== null && parseDecimalToUnits(amount, USDC_DECIMALS, "Amount") < floor.units;
@@ -80213,16 +80661,16 @@ async function tradeBuy(coinArg, amount, opts) {
80213
80661
  try {
80214
80662
  units = parseDecimalToUnits(amount, USDC_DECIMALS, "Buy amount");
80215
80663
  } catch (err) {
80216
- fail7(err.message, opts.json);
80664
+ fail8(err.message, opts.json);
80217
80665
  }
80218
- if (units <= 0n) fail7("Buy amount must be above zero.", opts.json);
80666
+ if (units <= 0n) fail8("Buy amount must be above zero.", opts.json);
80219
80667
  const floor = servedFloorUnits(ctx2);
80220
80668
  if (floor && units < floor.units) {
80221
- fail7(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
80669
+ fail8(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
80222
80670
  }
80223
80671
  const { keypair, state, created } = await loadOrCreateTradeKey();
80224
80672
  if (created && !opts.json) {
80225
- process.stderr.write(import_picocolors36.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
80673
+ process.stderr.write(import_picocolors37.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
80226
80674
  `));
80227
80675
  }
80228
80676
  const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
@@ -80233,23 +80681,23 @@ async function tradeSell(coinArg, amount, opts) {
80233
80681
  await withContext(opts, async (ctx2) => {
80234
80682
  const coin = await resolveCoin(coinArg);
80235
80683
  const key = await loadTradeKey();
80236
- if (!key) fail7("No agent trading key yet (nothing to sell with). Run: agentgates trade key", opts.json);
80684
+ if (!key) fail8("No agent trading key yet (nothing to sell with). Run: agentgates trade key", opts.json);
80237
80685
  let sellAmount = amount.trim();
80238
80686
  const pct = sellAmount.match(/^(\d+)%$/);
80239
80687
  if (sellAmount === "all" || pct) {
80240
80688
  const bal = await readTokenBalance(rpcConnection(), key.state.address, coin.mint);
80241
- if (!bal) fail7("Could not read the coin balance from the RPC; pass an explicit amount.", opts.json);
80242
- if (bal.units <= 0n) fail7("This key holds none of that coin.", opts.json);
80689
+ if (!bal) fail8("Could not read the coin balance from the RPC; pass an explicit amount.", opts.json);
80690
+ if (bal.units <= 0n) fail8("This key holds none of that coin.", opts.json);
80243
80691
  let units = bal.units;
80244
80692
  if (pct) {
80245
80693
  const p = BigInt(pct[1]);
80246
- if (p <= 0n || p > 100n) fail7(`Percentage must be 1-100, got "${amount}".`, opts.json);
80694
+ if (p <= 0n || p > 100n) fail8(`Percentage must be 1-100, got "${amount}".`, opts.json);
80247
80695
  units = bal.units * p / 100n;
80248
80696
  }
80249
- if (units <= 0n) fail7("Sell amount rounds to zero.", opts.json);
80697
+ if (units <= 0n) fail8("Sell amount rounds to zero.", opts.json);
80250
80698
  sellAmount = formatUnits2(units, bal.decimals);
80251
80699
  } else if (!/^\d+(\.\d+)?$/.test(sellAmount)) {
80252
- fail7(`Sell amount "${amount}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
80700
+ fail8(`Sell amount "${amount}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
80253
80701
  }
80254
80702
  const result = await runTrade({ ctx: ctx2, keypair: key.keypair, token: coin.mint, side: "sell", amount: sellAmount, minOut: opts.minOut });
80255
80703
  await reportTrade(ctx2, opts, { side: "sell", coin, address: key.state.address, amount: sellAmount, result });
@@ -80264,19 +80712,19 @@ function describeOrder(o) {
80264
80712
  async function tradeOrderPlace(coinArg, opts) {
80265
80713
  await withContext(opts, async (ctx2) => {
80266
80714
  if (opts.buy === void 0 === (opts.sell === void 0)) {
80267
- fail7("Pass exactly one of --buy <usdc> or --sell <amount|N%|all>.", opts.json);
80715
+ fail8("Pass exactly one of --buy <usdc> or --sell <amount|N%|all>.", opts.json);
80268
80716
  }
80269
80717
  if (opts.at === void 0 === (opts.onGraduation !== true)) {
80270
- fail7("Pass exactly one trigger: --at <value> (price, or mcap with --mcap) or --on-graduation.", opts.json);
80718
+ fail8("Pass exactly one trigger: --at <value> (price, or mcap with --mcap) or --on-graduation.", opts.json);
80271
80719
  }
80272
80720
  const coin = await resolveCoin(coinArg);
80273
80721
  const side = opts.buy !== void 0 ? "buy" : "sell";
80274
80722
  const kind = opts.onGraduation ? side === "buy" ? "buy_on_graduation" : "sell_on_graduation" : side === "buy" ? "buy_at" : "sell_at";
80275
- if (opts.stop && kind !== "sell_at") fail7("--stop only applies to a --sell order with --at.", opts.json);
80276
- if (opts.mcap && !opts.at) fail7("--mcap qualifies --at.", opts.json);
80723
+ if (opts.stop && kind !== "sell_at") fail8("--stop only applies to a --sell order with --at.", opts.json);
80724
+ if (opts.mcap && !opts.at) fail8("--mcap qualifies --at.", opts.json);
80277
80725
  const { keypair, state, created } = await loadOrCreateTradeKey();
80278
80726
  if (created && !opts.json) {
80279
- process.stderr.write(import_picocolors36.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
80727
+ process.stderr.write(import_picocolors37.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
80280
80728
  `));
80281
80729
  }
80282
80730
  let amount;
@@ -80285,11 +80733,11 @@ async function tradeOrderPlace(coinArg, opts) {
80285
80733
  try {
80286
80734
  units = parseDecimalToUnits(opts.buy, USDC_DECIMALS, "Buy amount");
80287
80735
  } catch (err) {
80288
- fail7(err.message, opts.json);
80736
+ fail8(err.message, opts.json);
80289
80737
  }
80290
80738
  const floor = servedFloorUnits(ctx2);
80291
80739
  if (floor && units < floor.units) {
80292
- fail7(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
80740
+ fail8(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
80293
80741
  }
80294
80742
  amount = opts.buy;
80295
80743
  } else {
@@ -80297,24 +80745,24 @@ async function tradeOrderPlace(coinArg, opts) {
80297
80745
  const pct = amount.match(/^(\d+)%$/);
80298
80746
  if (amount === "all" || pct) {
80299
80747
  const bal = await readTokenBalance(rpcConnection(), state.address, coin.mint);
80300
- if (!bal) fail7("Could not read the coin balance from the RPC; pass an explicit amount.", opts.json);
80301
- if (bal.units <= 0n) fail7("This key holds none of that coin.", opts.json);
80748
+ if (!bal) fail8("Could not read the coin balance from the RPC; pass an explicit amount.", opts.json);
80749
+ if (bal.units <= 0n) fail8("This key holds none of that coin.", opts.json);
80302
80750
  let units = bal.units;
80303
80751
  if (pct) {
80304
80752
  const p = BigInt(pct[1]);
80305
- if (p <= 0n || p > 100n) fail7(`Percentage must be 1-100, got "${opts.sell}".`, opts.json);
80753
+ if (p <= 0n || p > 100n) fail8(`Percentage must be 1-100, got "${opts.sell}".`, opts.json);
80306
80754
  units = bal.units * p / 100n;
80307
80755
  }
80308
- if (units <= 0n) fail7("Sell amount rounds to zero.", opts.json);
80756
+ if (units <= 0n) fail8("Sell amount rounds to zero.", opts.json);
80309
80757
  amount = formatUnits2(units, bal.decimals);
80310
80758
  } else if (!/^\d+(\.\d+)?$/.test(amount)) {
80311
- fail7(`Sell amount "${opts.sell}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
80759
+ fail8(`Sell amount "${opts.sell}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
80312
80760
  }
80313
80761
  }
80314
80762
  let expiresInDays;
80315
80763
  if (opts.expiresDays !== void 0) {
80316
80764
  const n2 = Number(opts.expiresDays);
80317
- if (!Number.isInteger(n2) || n2 < 1) fail7(`--expires-days must be a positive integer, got "${opts.expiresDays}".`, opts.json);
80765
+ if (!Number.isInteger(n2) || n2 < 1) fail8(`--expires-days must be a positive integer, got "${opts.expiresDays}".`, opts.json);
80318
80766
  expiresInDays = n2;
80319
80767
  }
80320
80768
  const prepared = await prepareOrder({
@@ -80350,7 +80798,7 @@ async function tradeOrderPlace(coinArg, opts) {
80350
80798
  async function tradeOrdersList(opts) {
80351
80799
  await withContext(opts, async (ctx2) => {
80352
80800
  const key = await loadTradeKey();
80353
- if (!key) fail7("No agent trading key yet. Run: agentgates trade key", opts.json);
80801
+ if (!key) fail8("No agent trading key yet. Run: agentgates trade key", opts.json);
80354
80802
  const token = opts.coin ? (await resolveCoin(opts.coin)).mint : void 0;
80355
80803
  const res = await listOrders(key.state.address, token);
80356
80804
  if (opts.json) {
@@ -80370,15 +80818,15 @@ async function tradeOrdersList(opts) {
80370
80818
  async function tradeOrderCancel(id2, opts) {
80371
80819
  await withContext(opts, async (_ctx) => {
80372
80820
  const key = await loadTradeKey();
80373
- if (!key) fail7("No agent trading key yet. Run: agentgates trade key", opts.json);
80821
+ if (!key) fail8("No agent trading key yet. Run: agentgates trade key", opts.json);
80374
80822
  try {
80375
80823
  await cancelOrder(id2, key.state.address);
80376
80824
  } catch (err) {
80377
80825
  if (err instanceof RelayError && err.status === 409) {
80378
- fail7(`Order ${id2} already fired or ended; nothing to cancel.`, opts.json);
80826
+ fail8(`Order ${id2} already fired or ended; nothing to cancel.`, opts.json);
80379
80827
  }
80380
80828
  if (err instanceof RelayError && err.status === 404) {
80381
- fail7(`No order ${id2} for this key (already canceled, or never placed).`, opts.json);
80829
+ fail8(`No order ${id2} for this key (already canceled, or never placed).`, opts.json);
80382
80830
  }
80383
80831
  throw err;
80384
80832
  }
@@ -80393,12 +80841,12 @@ async function tradeOrderCancel(id2, opts) {
80393
80841
  async function tradePositions(opts) {
80394
80842
  await withContext(opts, async (ctx2) => {
80395
80843
  const key = await loadTradeKey();
80396
- if (!key) fail7("No agent trading key yet. Run: agentgates trade key", opts.json);
80844
+ if (!key) fail8("No agent trading key yet. Run: agentgates trade key", opts.json);
80397
80845
  let body;
80398
80846
  try {
80399
80847
  body = await relayGet(`/launch-portfolio?address=${encodeURIComponent(key.state.address)}`);
80400
80848
  } catch (err) {
80401
- if (err instanceof RelayError) fail7(`Positions read failed: ${err.message}`, opts.json);
80849
+ if (err instanceof RelayError) fail8(`Positions read failed: ${err.message}`, opts.json);
80402
80850
  throw err;
80403
80851
  }
80404
80852
  const rows = body?.tokens ?? [];
@@ -80441,7 +80889,7 @@ async function tradePositions(opts) {
80441
80889
  }
80442
80890
 
80443
80891
  // src/commands/desk.ts
80444
- var import_picocolors37 = __toESM(require_picocolors(), 1);
80892
+ var import_picocolors38 = __toESM(require_picocolors(), 1);
80445
80893
  init_constants();
80446
80894
 
80447
80895
  // src/lib/desk-sol.ts
@@ -80612,11 +81060,11 @@ async function runDeskTrade(args) {
80612
81060
  }
80613
81061
 
80614
81062
  // src/commands/desk.ts
80615
- function fail8(message, json2) {
81063
+ function fail9(message, json2) {
80616
81064
  if (json2) {
80617
81065
  process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
80618
81066
  } else {
80619
- process.stderr.write(import_picocolors37.default.red(`\u2715 ${message}
81067
+ process.stderr.write(import_picocolors38.default.red(`\u2715 ${message}
80620
81068
  `));
80621
81069
  }
80622
81070
  process.exit(1);
@@ -80626,7 +81074,7 @@ async function withDesk(opts, fn) {
80626
81074
  const ctx2 = await resolveDeskContext();
80627
81075
  return await fn(ctx2);
80628
81076
  } catch (err) {
80629
- fail8(err.message, opts.json);
81077
+ fail9(err.message, opts.json);
80630
81078
  }
80631
81079
  }
80632
81080
  function servedFloorUnits2(ctx2) {
@@ -80637,7 +81085,7 @@ function servedFloorUnits2(ctx2) {
80637
81085
  async function requireOwner(opts) {
80638
81086
  const key = await loadTradeKey();
80639
81087
  if (!key) {
80640
- fail8("No agent trading key yet (the desk's owner). Run: agentgates trade key", opts.json);
81088
+ fail9("No agent trading key yet (the desk's owner). Run: agentgates trade key", opts.json);
80641
81089
  }
80642
81090
  return key;
80643
81091
  }
@@ -80706,7 +81154,7 @@ async function deskStatus(opts) {
80706
81154
  if (opts.fills !== void 0) {
80707
81155
  const n2 = Number(opts.fills);
80708
81156
  if (!Number.isInteger(n2) || n2 <= 0) {
80709
- fail8(`--fills must be a positive integer, got "${opts.fills}".`, opts.json);
81157
+ fail9(`--fills must be a positive integer, got "${opts.fills}".`, opts.json);
80710
81158
  }
80711
81159
  fillsLimit = n2;
80712
81160
  }
@@ -80754,12 +81202,12 @@ async function deskDeposit(amount, opts) {
80754
81202
  try {
80755
81203
  units = parseDecimalToUnits(amount, USDC_DECIMALS, "Deposit amount");
80756
81204
  } catch (err) {
80757
- fail8(err.message, opts.json);
81205
+ fail9(err.message, opts.json);
80758
81206
  }
80759
- if (units <= 0n) fail8("Deposit amount must be above zero.", opts.json);
81207
+ if (units <= 0n) fail9("Deposit amount must be above zero.", opts.json);
80760
81208
  const { keypair, state, created } = await loadOrCreateTradeKey();
80761
81209
  if (created && !opts.json) {
80762
- process.stderr.write(import_picocolors37.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
81210
+ process.stderr.write(import_picocolors38.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
80763
81211
  `));
80764
81212
  }
80765
81213
  const result = await runDeskCeremony({
@@ -80800,7 +81248,7 @@ async function deskWithdraw(amount, opts) {
80800
81248
  const trimmed = amount.trim();
80801
81249
  if (trimmed !== "all") {
80802
81250
  if (!/^\d+(\.\d+)?$/.test(trimmed)) {
80803
- fail8(`Withdraw amount "${amount}" is not a decimal amount or "all".`, opts.json);
81251
+ fail9(`Withdraw amount "${amount}" is not a decimal amount or "all".`, opts.json);
80804
81252
  }
80805
81253
  }
80806
81254
  const result = await runDeskCeremony({
@@ -80839,28 +81287,28 @@ async function deskWithdraw(amount, opts) {
80839
81287
  }
80840
81288
  async function deskSessionRegister(opts) {
80841
81289
  await withDesk(opts, async (ctx2) => {
80842
- if (!opts.cap) fail8("--cap <usdc> is required: the per-trade cap is your risk statement, never defaulted.", opts.json);
80843
- if (!opts.minutes) fail8("--minutes <n> is required: the session expiry is your risk statement, never defaulted.", opts.json);
81290
+ if (!opts.cap) fail9("--cap <usdc> is required: the per-trade cap is your risk statement, never defaulted.", opts.json);
81291
+ if (!opts.minutes) fail9("--minutes <n> is required: the session expiry is your risk statement, never defaulted.", opts.json);
80844
81292
  let capUnits;
80845
81293
  try {
80846
81294
  capUnits = parseDecimalToUnits(opts.cap, USDC_DECIMALS, "Per-trade cap");
80847
81295
  } catch (err) {
80848
- fail8(err.message, opts.json);
81296
+ fail9(err.message, opts.json);
80849
81297
  }
80850
- if (capUnits <= 0n) fail8("Per-trade cap must be above zero.", opts.json);
81298
+ if (capUnits <= 0n) fail9("Per-trade cap must be above zero.", opts.json);
80851
81299
  const minutes = Number(opts.minutes);
80852
81300
  if (!Number.isInteger(minutes) || minutes <= 0) {
80853
- fail8(`--minutes must be a positive integer, got "${opts.minutes}".`, opts.json);
81301
+ fail9(`--minutes must be a positive integer, got "${opts.minutes}".`, opts.json);
80854
81302
  }
80855
81303
  const owner = await loadOrCreateTradeKey();
80856
81304
  if (owner.created && !opts.json) {
80857
- process.stderr.write(import_picocolors37.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
81305
+ process.stderr.write(import_picocolors38.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
80858
81306
  `));
80859
81307
  }
80860
81308
  const session = await loadOrCreateDeskSessionKey();
80861
81309
  if (session.created && !opts.json) {
80862
81310
  process.stderr.write(
80863
- import_picocolors37.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
81311
+ import_picocolors38.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
80864
81312
  `)
80865
81313
  );
80866
81314
  }
@@ -80934,7 +81382,7 @@ async function deskSessionRevoke(opts) {
80934
81382
  async function requireSessionKeypair(opts) {
80935
81383
  const session = await loadDeskSessionKey();
80936
81384
  if (!session) {
80937
- fail8(
81385
+ fail9(
80938
81386
  "No desk session key on this terminal. Register one: agentgates desk session register --cap <usdc> --minutes <n>",
80939
81387
  opts.json
80940
81388
  );
@@ -80978,12 +81426,12 @@ async function deskBuy(coinArg, amount, opts) {
80978
81426
  try {
80979
81427
  units = parseDecimalToUnits(amount, USDC_DECIMALS, "Buy amount");
80980
81428
  } catch (err) {
80981
- fail8(err.message, opts.json);
81429
+ fail9(err.message, opts.json);
80982
81430
  }
80983
- if (units <= 0n) fail8("Buy amount must be above zero.", opts.json);
81431
+ if (units <= 0n) fail9("Buy amount must be above zero.", opts.json);
80984
81432
  const floor = servedFloorUnits2(ctx2);
80985
81433
  if (floor && units < floor.units) {
80986
- fail8(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
81434
+ fail9(`Buys start at $${floor.usdc} (served by launch-config; the relay refuses below it).`, opts.json);
80987
81435
  }
80988
81436
  const owner = await requireOwner(opts);
80989
81437
  const session = await requireSessionKeypair(opts);
@@ -81008,16 +81456,16 @@ async function deskSell(coinArg, amount, opts) {
81008
81456
  const pct = sellAmount.match(/^(\d+)%$/);
81009
81457
  if (pct) {
81010
81458
  const state = await deskState(owner.state.address, coin.mint);
81011
- if (!state.coin) fail8("The desk holds none of that coin for this owner.", opts.json);
81459
+ if (!state.coin) fail9("The desk holds none of that coin for this owner.", opts.json);
81012
81460
  const credit = BigInt(state.coin.creditUnits);
81013
- if (credit <= 0n) fail8("The desk holds none of that coin for this owner.", opts.json);
81461
+ if (credit <= 0n) fail9("The desk holds none of that coin for this owner.", opts.json);
81014
81462
  const p = BigInt(pct[1]);
81015
- if (p <= 0n || p > 100n) fail8(`Percentage must be 1-100, got "${amount}".`, opts.json);
81463
+ if (p <= 0n || p > 100n) fail9(`Percentage must be 1-100, got "${amount}".`, opts.json);
81016
81464
  const units = credit * p / 100n;
81017
- if (units <= 0n) fail8("Sell amount rounds to zero.", opts.json);
81465
+ if (units <= 0n) fail9("Sell amount rounds to zero.", opts.json);
81018
81466
  sellAmount = formatUnits2(units, state.coin.decimals);
81019
81467
  } else if (sellAmount !== "all" && !/^\d+(\.\d+)?$/.test(sellAmount)) {
81020
- fail8(`Sell amount "${amount}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
81468
+ fail9(`Sell amount "${amount}" is not a coin amount, a percentage like 50%, or "all".`, opts.json);
81021
81469
  }
81022
81470
  const result = await runDeskTrade({
81023
81471
  ctx: ctx2,
@@ -81406,7 +81854,7 @@ program2.command("fund").description(
81406
81854
  }
81407
81855
  if (opts.usdc || opts.gas || opts.chain) {
81408
81856
  process.stderr.write(
81409
- import_picocolors38.default.red(
81857
+ import_picocolors39.default.red(
81410
81858
  `\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
81411
81859
  `
81412
81860
  )
@@ -81607,7 +82055,7 @@ passwords.command("add").alias("store").description("Store a login: sealed on th
81607
82055
  passwords.command("allow").description("Sign a permit: which agent may use which rows on which sites, how many times a day, until when. Default: yourself, every row, every use, 30 days.").option("--agent <address>", "the key that will sign uses (default: this key)").option("--rows <id,id|*>", "row ids, or * for every row this key holds (default *)").option("--hosts <a,b>", "narrow to these hostnames (default: the rows' own)").option("--uses <login,totp,header>", "which uses (default all three)").option("--gets <session|password>", "what the agent gets: session = the site's cookies after the CVM logs in (default); password = the secret itself; cvm = the acting uses alone, for an agent that works inside the CVM over the API").option("--per-day <n>", "hard daily cap; 0 = the plan allowance (default 0)").option("--days <n>", "how long, 1 to 366 (default 30)").option("--ask-me", "every use waits for the owner's signature on their board (the brake)").option("--factors <device,codes,mail,sms>", "the account's sign-in verification step the agent may complete: device = the stored device credential answers the site's device step; codes = one of the stored backup codes is spent; mail = a code the site emails is read from your mailbox row or an inbox this key holds (allow the mailbox row too); sms = a code the site texts is read from a number this key holds").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81608
82056
  await passwordsAllow(opts);
81609
82057
  });
81610
- passwords.command("use").description("Log in through the CVM with a stored login and get the page's digest back, never the password. Pass --row, or just --url and the matching row is picked. A parked use (the owner has to approve, or type a code) is waited on until it answers.").option("--row <id>", "the row to use (default: the one whose hosts cover --url)").option("--url <https://site/login>", "the page the use targets").option("--use <login|header|totp|session|reveal>", "which use (default login); session hands this key the site's cookies, reveal the secret, when the permit says so").option("--cookies-out <file>", "session only: write the cookies to this file (Playwright addCookies / Puppeteer setCookie shape)").option("--steps-json <json>", "login only: steps the CVM runs inside the session after the login lands (goto, fill, click, wait, read; a click may name the control's text instead of a selector)").option("--code-steps-json <json>", "login only: the clicks that reach a code field the site keeps behind a 'try another way' menu (at most 4, click and wait), run before the code is typed").option("--enroll-device", "login only, your own key: provision a device credential for the account on this sign-in (the steps reach the page where the account adds a device); agentgates passwords device does this and seals it into the row").option("--attend", "login only, your own key: the CVM fills the password and holds the page for you at the controls (finish it on your board's live view); prints the use id and the view token").option("--use-id <id>", "continue a parked use by its id (Done on an attended sign-in, or a use the owner answered)").option("--mailbox <row>", "login and session: the mailbox row the box reads an emailed sign-in code from (default: your one mailbox row, when the permit covers it and lists mail)").option("--solve", "login and session, your own key: the CVM passes a bot check it meets (Cloudflare, Turnstile, reCAPTCHA, hCaptcha) by ticking it, then through its solver service").option("--request-json <json>", "the whole request object for header and totp uses (spec \xA75.1)").option("--wait <seconds>", "cap on how long to wait for the owner's answer (default: the owner's window)").option("--no-wait", "answer the parked use's id and return at once").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts, command) => {
82058
+ passwords.command("use").description("Log in through the CVM with a stored login and get the page's digest back, never the password. Pass --row, or just --url and the matching row is picked, or --workflow to run a task the owner taught the CVM. A parked use (the owner has to approve, or type a code) is waited on until it answers.").option("--row <id>", "the row to use (default: the one whose hosts cover --url)").option("--url <https://site/login>", "the page the use targets").option("--use <login|header|totp|session|reveal>", "which use (default login); session hands this key the site's cookies, reveal the secret, when the permit says so").option("--cookies-out <file>", "session only: write the cookies to this file (Playwright addCookies / Puppeteer setCookie shape)").option("--steps-json <json>", "login only: steps the CVM runs inside the session after the login lands (goto, fill, click, wait, read, press; a click may name the control's text instead of a selector)").option("--workflow <name>", "login only: run a workflow the owner taught the CVM on the row, by its name (passwords list shows them); --url may be left out").option("--input <name=value>", "a value the workflow takes, by its name; repeat for each (a value you leave out types what the owner typed)", (v, prev = []) => [...prev, v]).option("--code-steps-json <json>", "login only: the clicks that reach a code field the site keeps behind a 'try another way' menu (at most 4, click and wait), run before the code is typed").option("--enroll-device", "login only, your own key: provision a device credential for the account on this sign-in (the steps reach the page where the account adds a device); agentgates passwords device does this and seals it into the row").option("--attend", "login only, your own key: the CVM fills the password and holds the page for you at the controls (finish it on your board's live view); prints the use id and the view token").option("--use-id <id>", "continue a parked use by its id (Done on an attended sign-in, or a use the owner answered)").option("--mailbox <row>", "login and session: the mailbox row the box reads an emailed sign-in code from (default: your one mailbox row, when the permit covers it and lists mail)").option("--solve", "login and session, your own key: the CVM passes a bot check it meets (Cloudflare, Turnstile, reCAPTCHA, hCaptcha) by ticking it, then through its solver service").option("--request-json <json>", "the whole request object for header and totp uses (spec \xA75.1)").option("--wait <seconds>", "cap on how long to wait for the owner's answer (default: the owner's window)").option("--no-wait", "answer the parked use's id and return at once").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts, command) => {
81611
82059
  const waitSource = command.getOptionValueSource("wait");
81612
82060
  await passwordsUse({ ...opts, noWait: waitSource === "cli" && opts.wait === false, wait: typeof opts.wait === "string" ? opts.wait : void 0 });
81613
82061
  });
@@ -81763,6 +82211,35 @@ intents.command("rate <askId>").description("Rate a business's leg that settled
81763
82211
  intents.command("noshow <askId>").description("Mark a no-show on a committed leg of yours: a fact on the poster's record that sellers see.").requiredOption("--offer <offerId>", "your committed leg").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (askId, opts) => {
81764
82212
  await intentsNoShow(askId, opts);
81765
82213
  });
82214
+ var integrations = program2.command("integrations").description("Outside accounts this account connected (GitHub, Vercel, Neon, Google Drive, Dropbox, and the sites and API tokens kept in Passwords), and an agent's read of one under the owner's permit.");
82215
+ integrations.command("list", { isDefault: true }).description("The account's integrations: provider, account name (opened here), state, what uses it.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
82216
+ await integrationsList(opts);
82217
+ });
82218
+ integrations.command("use <integrationId>").description("As an agent the owner permitted: list the folders the owner picked (--folder <id> lists inside one), or read one file (--file <id>); on Vercel or Neon, list the projects. Sealed to this agent's own key and opened here. A permit that asks each use waits for the owner's answer.").option("--folder <id>", "a folder id from a listing").option("--file <id>", "a file id from a listing").option("--wait <seconds>", "how long to wait for the owner's answer (default 300, at most 900)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (integrationId, opts) => {
82219
+ await integrationsUse(integrationId, opts);
82220
+ });
82221
+ integrations.command("signup <provider>").description("Stage 4: open a signup row that makes the owner's free account on GitHub, Vercel or Neon with the owner's Agentgates email. Prints the row's id and the inbox the account is made with.").option("--inbox <id>", "an inbox the owner holds (default: the account's free inbox, minted when none)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (provider, opts) => {
82222
+ await integrationsSignup(provider, opts);
82223
+ });
82224
+ integrations.command("signup-report <signupId>").description("Report a signup's run: the Passwords row the login was stored in (--login-id).").option("--login-id <rowId>", "the passwords row the login landed in").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (signupId, opts) => {
82225
+ await integrationsSignupReport(signupId, opts);
82226
+ });
82227
+ integrations.command("signup-handoff <signupId> <provider>").description("Hand the connect material back and connect the row: GitHub's install redirect (--code --installation-id), Vercel's (--code --configuration-id), or Neon's key sealed to the box (--sealed <file> with {grantCvm, cvmKeyId}).").option("--code <code>", "the provider's install redirect code").option("--installation-id <id>", "GitHub's installation id").option("--setup-action <action>", "GitHub's setup action (install|request)").option("--configuration-id <id>", "Vercel's configuration id").option("--team-id <id>", "Vercel's team id").option("--redirect-uri <url>", "the address the provider sent the browser back to").option("--sealed <file>", "a file holding {grantCvm, cvmKeyId} (Neon)").option("--grant-cvm <blob>", "the Neon grant sealed to the connections CVM").option("--cvm-key-id <id>", "the CVM key id the grant is sealed under").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (signupId, provider, opts) => {
82228
+ await integrationsSignupHandoff(signupId, provider, opts);
82229
+ });
82230
+ var sites = program2.command("sites").description("The account's sites and the changes Agentgates AI makes to them.");
82231
+ sites.command("list", { isDefault: true }).description("The account's sites: one Vercel project each and the GitHub repo behind it; name, repo and address opened here.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
82232
+ await sitesList(opts);
82233
+ });
82234
+ sites.command("change <changeId>").description("One change to a site: where it stands, its rounds and its latest card, opened here with the account's data key.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (changeId, opts) => {
82235
+ await sitesChange(changeId, opts);
82236
+ });
82237
+ sites.command("ship <changeId>").description("Ship a ready change: the owner's signature over the change and the head its card stands for.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (changeId, opts) => {
82238
+ await sitesShip(changeId, opts);
82239
+ });
82240
+ sites.command("skip <changeId>").description("Close a change that has not shipped.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (changeId, opts) => {
82241
+ await sitesSkip(changeId, opts);
82242
+ });
81766
82243
  var memory = program2.command("memory").description("Sealed folders of markdown your agents read: names and bodies are sealed on this machine to the account's data key; the wire and the server carry ciphertext only.");
81767
82244
  memory.command("overview", { isDefault: true }).description("The folders, their counts, and what the plan allows.").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
81768
82245
  await memoryOverview(opts);
@@ -81864,10 +82341,10 @@ mcp.command("install").description("Print the lines that add this server to Clau
81864
82341
  mcpInstall();
81865
82342
  });
81866
82343
  program2.parseAsync(process.argv).catch((err) => {
81867
- process.stderr.write(import_picocolors38.default.red(`\u2715 ${err.message}
82344
+ process.stderr.write(import_picocolors39.default.red(`\u2715 ${err.message}
81868
82345
  `));
81869
82346
  if (process.env.BOUNTY_DEBUG) {
81870
- process.stderr.write(import_picocolors38.default.dim((err.stack ?? "") + "\n"));
82347
+ process.stderr.write(import_picocolors39.default.dim((err.stack ?? "") + "\n"));
81871
82348
  }
81872
82349
  process.exit(1);
81873
82350
  });