@agentgates/cli 0.83.0 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.mjs +13 -9
  2. package/package.json +3 -3
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.83.0";
3131
+ CLI_VERSION = "0.84.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
  }
@@ -64301,6 +64301,7 @@ async function* streamSse(url, opts = {}) {
64301
64301
  if (opts.bearer) {
64302
64302
  headers["authorization"] = `Bearer ${opts.bearer}`;
64303
64303
  }
64304
+ if (opts.headers) Object.assign(headers, opts.headers);
64304
64305
  let res;
64305
64306
  try {
64306
64307
  res = await fetch(url, {
@@ -64389,7 +64390,7 @@ async function runLoginFlow(opts) {
64389
64390
  const init2 = await apiFetch("/api/login-init", {
64390
64391
  method: "POST",
64391
64392
  origin,
64392
- body: { clientLabel: defaultClientLabel() }
64393
+ body: { clientLabel: defaultClientLabel(), v: 2 }
64393
64394
  });
64394
64395
  const expiresAt = new Date(Date.now() + init2.expiresIn * 1e3).toISOString();
64395
64396
  if (opts.jsonMode) {
@@ -64430,7 +64431,7 @@ ${opts.ttyHeader}
64430
64431
  }
64431
64432
  let sawAny = false;
64432
64433
  try {
64433
- for await (const ev of streamSse(streamUrl, {})) {
64434
+ for await (const ev of streamSse(streamUrl, init2.loginSecret ? { headers: { "x-login-secret": init2.loginSecret } } : {})) {
64434
64435
  sawAny = true;
64435
64436
  if (ev.status === "approved") {
64436
64437
  approved = ev;
@@ -69756,6 +69757,7 @@ import { writeFileSync } from "node:fs";
69756
69757
 
69757
69758
  // src/lib/payphone-wire.ts
69758
69759
  init_constants();
69760
+ init_lib2();
69759
69761
  init_passwords_wire();
69760
69762
  async function wakeTheOperator() {
69761
69763
  try {
@@ -69774,9 +69776,10 @@ function isWaking(status4, error) {
69774
69776
  var WAKE_WAIT_MS = 24e4;
69775
69777
  var WAKE_POLL_MS = 1e4;
69776
69778
  var PAYPHONE_MINUTES = [1, 2, 5, 10];
69777
- async function post(body, payment, timeoutMs) {
69779
+ async function post(body, payment, timeoutMs, payer) {
69778
69780
  const headers = { "content-type": "application/json", "user-agent": CLI_USER_AGENT };
69779
69781
  if (payment) headers["X-PAYMENT"] = payment;
69782
+ if (payment && payer) headers["X-Wallet-Auth"] = await ownerAuthHeader(payer, "POST", lanePath("/booth"));
69780
69783
  const res = await fetch(`${siteOrigin()}${lanePath("/booth")}`, {
69781
69784
  method: "POST",
69782
69785
  headers,
@@ -69806,7 +69809,8 @@ async function payphoneCall(args) {
69806
69809
  }
69807
69810
  args.onQuote?.(`paying ${usd(choice.leg.amountMicro)} on ${choice.leg.network}`);
69808
69811
  const signed2 = await signLeg(choice.leg, args.privateKey);
69809
- let paid = await post(body, signed2.header, 18e4);
69812
+ const payer = new ethers_exports.Wallet(args.privateKey);
69813
+ let paid = await post(body, signed2.header, 18e4, payer);
69810
69814
  if (paid.status >= 400) {
69811
69815
  const first = typeof paid.json.error === "string" ? paid.json.error : "";
69812
69816
  if (isWaking(paid.status, first)) {
@@ -69814,7 +69818,7 @@ async function payphoneCall(args) {
69814
69818
  const deadline = Date.now() + WAKE_WAIT_MS;
69815
69819
  while (Date.now() < deadline) {
69816
69820
  await new Promise((r) => setTimeout(r, WAKE_POLL_MS));
69817
- paid = await post(body, signed2.header, 18e4);
69821
+ paid = await post(body, signed2.header, 18e4, payer);
69818
69822
  if (paid.status < 400) break;
69819
69823
  const again = typeof paid.json.error === "string" ? paid.json.error : "";
69820
69824
  if (!isWaking(paid.status, again)) break;
@@ -69829,10 +69833,10 @@ async function payphoneCall(args) {
69829
69833
  const call = paid.json.call ?? paid.json.booth ?? paid.json ?? {};
69830
69834
  return { call, payment: signed2.header, body, paidMicro: choice.leg.amountMicro, network: choice.leg.network, from: signed2.from };
69831
69835
  }
69832
- async function payphoneRead(payment, asked, what) {
69836
+ async function payphoneRead(payment, asked, what, privateKey) {
69833
69837
  const body = { ...asked, kind: "call" };
69834
69838
  body[what === "read" ? "read" : "hangup"] = true;
69835
- const out = await post(body, payment, 6e4);
69839
+ const out = await post(body, payment, 6e4, new ethers_exports.Wallet(privateKey));
69836
69840
  if (out.status >= 400) {
69837
69841
  const error = typeof out.json.error === "string" ? out.json.error : `the payphone answered ${out.status}`;
69838
69842
  throw new WireError(out.status, typeof out.json.code === "string" ? out.json.code : null, error, out.json);
@@ -70070,7 +70074,7 @@ async function walkUpToThePayphone(opts, args) {
70070
70074
  if (row?.status && TERMINAL.has(row.status)) break;
70071
70075
  await new Promise((r) => setTimeout(r, 4e3));
70072
70076
  try {
70073
- row = await payphoneRead(walk.payment, walk.body, "read");
70077
+ row = await payphoneRead(walk.payment, walk.body, "read", args.privateKey);
70074
70078
  } catch {
70075
70079
  break;
70076
70080
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentgates/cli",
3
- "version": "0.83.0",
3
+ "version": "0.84.0",
4
4
  "description": "Wallet operations for AI agents and humans",
5
5
  "keywords": [
6
6
  "crypto",
@@ -18,10 +18,10 @@
18
18
  "homepage": "https://agentgates.ai",
19
19
  "repository": {
20
20
  "type": "git",
21
- "url": "git+https://github.com/Carlos-Sotop/agentgates.git"
21
+ "url": "git+https://github.com/agentgates-ai/agentgates.git"
22
22
  },
23
23
  "bugs": {
24
- "url": "https://github.com/Carlos-Sotop/agentgates/issues",
24
+ "url": "https://github.com/agentgates-ai/agentgates/issues",
25
25
  "email": "support@agentgates.ai"
26
26
  },
27
27
  "author": "Agentgates",