@agentgates/cli 0.12.0 → 0.13.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.
- package/dist/cli.mjs +408 -265
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3118,7 +3118,7 @@ var require_package = __commonJS({
|
|
|
3118
3118
|
"package.json"(exports, module) {
|
|
3119
3119
|
module.exports = {
|
|
3120
3120
|
name: "@agentgates/cli",
|
|
3121
|
-
version: "0.
|
|
3121
|
+
version: "0.13.0",
|
|
3122
3122
|
description: "Wallet operations for AI agents and humans",
|
|
3123
3123
|
keywords: [
|
|
3124
3124
|
"crypto",
|
|
@@ -34373,7 +34373,7 @@ var {
|
|
|
34373
34373
|
} = import_index.default;
|
|
34374
34374
|
|
|
34375
34375
|
// src/main.ts
|
|
34376
|
-
var
|
|
34376
|
+
var import_picocolors27 = __toESM(require_picocolors(), 1);
|
|
34377
34377
|
|
|
34378
34378
|
// src/commands/login.ts
|
|
34379
34379
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
@@ -35346,7 +35346,7 @@ function shortAddress(addr) {
|
|
|
35346
35346
|
}
|
|
35347
35347
|
|
|
35348
35348
|
// src/commands/onboard.ts
|
|
35349
|
-
var
|
|
35349
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
35350
35350
|
import { createInterface } from "node:readline/promises";
|
|
35351
35351
|
|
|
35352
35352
|
// src/lib/water.ts
|
|
@@ -35701,6 +35701,124 @@ async function phoneCall() {
|
|
|
35701
35701
|
);
|
|
35702
35702
|
}
|
|
35703
35703
|
|
|
35704
|
+
// src/commands/email.ts
|
|
35705
|
+
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
35706
|
+
var SITE4 = (process.env.AGENTGATES_ORIGIN || "https://agentgates.ai").replace(/\/$/, "");
|
|
35707
|
+
var usd3 = (v) => {
|
|
35708
|
+
const n = Number(v);
|
|
35709
|
+
if (Number.isInteger(n)) return `$${n}`;
|
|
35710
|
+
const [whole, frac = ""] = n.toFixed(6).replace(/0+$/, "").split(".");
|
|
35711
|
+
return `$${whole}.${frac.padEnd(2, "0")}`;
|
|
35712
|
+
};
|
|
35713
|
+
var family = (rung) => {
|
|
35714
|
+
const base = rung.replace(/-?(month|year)$/, "");
|
|
35715
|
+
return base === "" ? "Starter" : base.charAt(0).toUpperCase() + base.slice(1);
|
|
35716
|
+
};
|
|
35717
|
+
function emailSlice(body) {
|
|
35718
|
+
const out = {
|
|
35719
|
+
...body,
|
|
35720
|
+
products: (body.products ?? []).filter((p) => p.id === "inbox"),
|
|
35721
|
+
rungs: (body.rungs ?? []).filter((r) => r.product === "inbox"),
|
|
35722
|
+
prices: (body.prices ?? []).filter((p) => p.product === "inbox")
|
|
35723
|
+
};
|
|
35724
|
+
for (const k of ["booth", "phoneUsage", "voices", "operator", "countries"]) {
|
|
35725
|
+
delete out[k];
|
|
35726
|
+
}
|
|
35727
|
+
return out;
|
|
35728
|
+
}
|
|
35729
|
+
async function emailPricing(opts) {
|
|
35730
|
+
const res = await fetch(`${SITE4}/api/identity/catalog`, { headers: { accept: "application/json" } });
|
|
35731
|
+
if (!res.ok) throw new Error(`email catalog: HTTP ${res.status}`);
|
|
35732
|
+
const body = await res.json();
|
|
35733
|
+
const slice = emailSlice(body);
|
|
35734
|
+
const product = slice.products?.[0];
|
|
35735
|
+
if (opts.json) {
|
|
35736
|
+
process.stdout.write(JSON.stringify(slice, null, 2) + "\n");
|
|
35737
|
+
if (!product || product.available === false) process.exitCode = 1;
|
|
35738
|
+
return;
|
|
35739
|
+
}
|
|
35740
|
+
if (!product || product.available === false) {
|
|
35741
|
+
process.stdout.write(` ${import_picocolors6.default.dim(product?.note || product?.brief || "Inboxes are not on sale right now.")}
|
|
35742
|
+
`);
|
|
35743
|
+
process.exitCode = 1;
|
|
35744
|
+
return;
|
|
35745
|
+
}
|
|
35746
|
+
process.stdout.write(`
|
|
35747
|
+
${import_picocolors6.default.bold("EMAIL")} ${import_picocolors6.default.dim(product.brief || "an inbox on your wallet")}
|
|
35748
|
+
|
|
35749
|
+
`);
|
|
35750
|
+
const freeInboxes = slice.payg?.inboxes;
|
|
35751
|
+
if (freeInboxes) {
|
|
35752
|
+
const at = product.domain ? ` @ ${product.domain}` : "";
|
|
35753
|
+
process.stdout.write(
|
|
35754
|
+
` ${import_picocolors6.default.bold("free".padEnd(11))} ${import_picocolors6.default.cyan("$0".padStart(4))}${"".padEnd(11)} ${import_picocolors6.default.dim(`${freeInboxes} inbox${freeInboxes === 1 ? "" : "es"}${at}, behind a funded balance`)}
|
|
35755
|
+
`
|
|
35756
|
+
);
|
|
35757
|
+
}
|
|
35758
|
+
const plans = slice.prices ?? [];
|
|
35759
|
+
const families = [];
|
|
35760
|
+
const byFamily = /* @__PURE__ */ new Map();
|
|
35761
|
+
for (const p of plans) {
|
|
35762
|
+
const f = family(p.rung);
|
|
35763
|
+
if (!byFamily.has(f)) {
|
|
35764
|
+
byFamily.set(f, []);
|
|
35765
|
+
families.push(f);
|
|
35766
|
+
}
|
|
35767
|
+
byFamily.get(f).push(p);
|
|
35768
|
+
}
|
|
35769
|
+
for (const f of families) {
|
|
35770
|
+
const rows = byFamily.get(f).sort((a, b) => a.units - b.units);
|
|
35771
|
+
const cells = rows.map((p) => `${import_picocolors6.default.cyan(usd3(p.priceUsd).padStart(4))}${import_picocolors6.default.dim(`/${p.units} days`.padEnd(10))}`).join(" ");
|
|
35772
|
+
const lead = rows[0];
|
|
35773
|
+
const cap = [
|
|
35774
|
+
lead.inboxes ? `${lead.inboxes} inbox${lead.inboxes === 1 ? "" : "es"}` : "",
|
|
35775
|
+
lead.sendsPerDay ? `${lead.sendsPerDay} sends/day` : ""
|
|
35776
|
+
].filter(Boolean).join(" \xB7 ");
|
|
35777
|
+
process.stdout.write(` ${import_picocolors6.default.bold(f.padEnd(11))} ${cells} ${import_picocolors6.default.dim(cap)}
|
|
35778
|
+
`);
|
|
35779
|
+
}
|
|
35780
|
+
if (plans.length === 0) process.stdout.write(` ${import_picocolors6.default.dim("no plan rungs are priced right now")}
|
|
35781
|
+
`);
|
|
35782
|
+
const send2 = slice.sendOverflow?.priceUsd;
|
|
35783
|
+
const wait = body.phoneUsage?.waitCodeUsd;
|
|
35784
|
+
const meter = [
|
|
35785
|
+
send2 ? `send ${usd3(send2)}` : "",
|
|
35786
|
+
wait !== void 0 ? `wait-code ${Number(wait) === 0 ? "free" : usd3(wait)}` : ""
|
|
35787
|
+
].filter(Boolean).join(" \xB7 ");
|
|
35788
|
+
if (meter) process.stdout.write(`
|
|
35789
|
+
${import_picocolors6.default.dim(`usage, from the prepaid balance: ${meter}`)}
|
|
35790
|
+
`);
|
|
35791
|
+
process.stdout.write(` ${import_picocolors6.default.dim("receiving costs nothing; the plan sells inboxes and sends per day")}
|
|
35792
|
+
`);
|
|
35793
|
+
const bal = slice.balance;
|
|
35794
|
+
if (bal?.note) process.stdout.write(` ${import_picocolors6.default.dim(bal.note)}
|
|
35795
|
+
`);
|
|
35796
|
+
else if (bal?.minTopUpUsd) process.stdout.write(` ${import_picocolors6.default.dim(`top up any amount from ${usd3(bal.minTopUpUsd)}`)}
|
|
35797
|
+
`);
|
|
35798
|
+
const nets = [...new Set((plans[0]?.byNetwork ?? []).map((n) => n.network))];
|
|
35799
|
+
if (nets.length) process.stdout.write(`
|
|
35800
|
+
${import_picocolors6.default.dim(`USDC on ${nets.join(", ")}`)}
|
|
35801
|
+
|
|
35802
|
+
`);
|
|
35803
|
+
else process.stdout.write("\n");
|
|
35804
|
+
}
|
|
35805
|
+
function emailDoor(first) {
|
|
35806
|
+
process.stdout.write(
|
|
35807
|
+
`
|
|
35808
|
+
${first}, and this CLI has no signer yet.
|
|
35809
|
+
Do it from the wallet, one biometric: ${import_picocolors6.default.cyan(`${SITE4}/email`)}
|
|
35810
|
+
Prices from here: ${import_picocolors6.default.dim("agentgates email pricing")}
|
|
35811
|
+
|
|
35812
|
+
`
|
|
35813
|
+
);
|
|
35814
|
+
}
|
|
35815
|
+
async function emailCreate() {
|
|
35816
|
+
emailDoor("An inbox is created under your wallet's own signature");
|
|
35817
|
+
}
|
|
35818
|
+
async function emailSend() {
|
|
35819
|
+
emailDoor("A send signs with your wallet and draws from its balance");
|
|
35820
|
+
}
|
|
35821
|
+
|
|
35704
35822
|
// src/commands/onboard.ts
|
|
35705
35823
|
var WORDMARK = [
|
|
35706
35824
|
" _ _",
|
|
@@ -35709,7 +35827,7 @@ var WORDMARK = [
|
|
|
35709
35827
|
" \\__,_\\__, \\___|_||_\\__\\__, \\__,_|\\__\\___/__/",
|
|
35710
35828
|
" |___/ |___/"
|
|
35711
35829
|
].join("\n");
|
|
35712
|
-
var TAGLINE = "Confidential virtual machines, inference
|
|
35830
|
+
var TAGLINE = "Confidential virtual machines, inference, phone numbers and email, paid per use in USDC.";
|
|
35713
35831
|
var { version: LOCAL_VERSION } = require_package();
|
|
35714
35832
|
function olderThan(a, b) {
|
|
35715
35833
|
const pa = a.split(".").map(Number);
|
|
@@ -35731,7 +35849,7 @@ async function staleLine() {
|
|
|
35731
35849
|
if (!res.ok) return null;
|
|
35732
35850
|
const { version: latest } = await res.json();
|
|
35733
35851
|
if (!latest || !olderThan(LOCAL_VERSION, latest)) return null;
|
|
35734
|
-
return ` ${
|
|
35852
|
+
return ` ${import_picocolors7.default.yellow("\u2191")} ${latest} is out, this copy is ${LOCAL_VERSION} \xB7 curl -fsSL ${CREATORS_ORIGIN}/api/cli/install | sh
|
|
35735
35853
|
|
|
35736
35854
|
`;
|
|
35737
35855
|
} catch {
|
|
@@ -35746,9 +35864,9 @@ function makePut(w) {
|
|
|
35746
35864
|
}
|
|
35747
35865
|
function banner() {
|
|
35748
35866
|
const w = water();
|
|
35749
|
-
if (!w) process.stdout.write("\n" +
|
|
35867
|
+
if (!w) process.stdout.write("\n" + import_picocolors7.default.cyan(WORDMARK) + "\n\n");
|
|
35750
35868
|
const put = makePut(w);
|
|
35751
|
-
put(` ${
|
|
35869
|
+
put(` ${import_picocolors7.default.dim(TAGLINE)}
|
|
35752
35870
|
|
|
35753
35871
|
`);
|
|
35754
35872
|
return { w, put };
|
|
@@ -35757,6 +35875,7 @@ var MENU = {
|
|
|
35757
35875
|
compute: { label: "see virtual machine pricing" },
|
|
35758
35876
|
models: { label: "see inference pricing" },
|
|
35759
35877
|
phone: { label: "see phone pricing" },
|
|
35878
|
+
email: { label: "see email pricing" },
|
|
35760
35879
|
docs: { label: "read the docs" },
|
|
35761
35880
|
poke: { label: "nothing, I'll poke around" },
|
|
35762
35881
|
wallet: { label: "pair my wallet", hint: "(members only)" }
|
|
@@ -35764,11 +35883,12 @@ var MENU = {
|
|
|
35764
35883
|
var LANES = {
|
|
35765
35884
|
compute: { key: "compute", name: "virtual machines", docs: "/api/compute/docs" },
|
|
35766
35885
|
inference: { key: "models", name: "inference", docs: "/api/inference/docs" },
|
|
35767
|
-
phone: { key: "phone", name: "phone", docs: "/api/identity/docs" }
|
|
35886
|
+
phone: { key: "phone", name: "phone", docs: "/api/identity/docs" },
|
|
35887
|
+
email: { key: "email", name: "email", docs: "/api/identity/docs" }
|
|
35768
35888
|
};
|
|
35769
|
-
var LANE_ORDER = ["compute", "inference", "phone"];
|
|
35889
|
+
var LANE_ORDER = ["compute", "inference", "phone", "email"];
|
|
35770
35890
|
function leadLane(lane) {
|
|
35771
|
-
return lane === "inference" || lane === "phone" ? lane : "compute";
|
|
35891
|
+
return lane === "inference" || lane === "phone" || lane === "email" ? lane : "compute";
|
|
35772
35892
|
}
|
|
35773
35893
|
function lanesLedBy(lane) {
|
|
35774
35894
|
const lead = leadLane(lane);
|
|
@@ -35779,11 +35899,11 @@ function menuOrder(lane) {
|
|
|
35779
35899
|
return [...browse, "docs", "poke", "wallet"];
|
|
35780
35900
|
}
|
|
35781
35901
|
function printMenu(put, order, first) {
|
|
35782
|
-
put(` ${
|
|
35902
|
+
put(` ${import_picocolors7.default.bold(first ? "choose how to start:" : "what next:")}
|
|
35783
35903
|
`);
|
|
35784
35904
|
order.forEach((k, i) => {
|
|
35785
35905
|
const item = MENU[k];
|
|
35786
|
-
put(` ${
|
|
35906
|
+
put(` ${import_picocolors7.default.cyan(`${i + 1}.`)} ${item.label}${item.hint ? ` ${import_picocolors7.default.dim(item.hint)}` : ""}
|
|
35787
35907
|
`);
|
|
35788
35908
|
});
|
|
35789
35909
|
}
|
|
@@ -35795,17 +35915,17 @@ async function printDocs(put, lane) {
|
|
|
35795
35915
|
if (!res.ok) throw new Error(String(res.status));
|
|
35796
35916
|
const md = (await res.text()).replace(/\s+$/, "");
|
|
35797
35917
|
put(`
|
|
35798
|
-
${
|
|
35918
|
+
${import_picocolors7.default.bold(`THE ${LANES[lead].name.toUpperCase()} CONTRACT`)} ${import_picocolors7.default.dim(url(lead))}
|
|
35799
35919
|
|
|
35800
35920
|
`);
|
|
35801
35921
|
put(md + "\n\n");
|
|
35802
|
-
for (const other of others) put(` ${
|
|
35922
|
+
for (const other of others) put(` ${import_picocolors7.default.dim(`the ${LANES[other].name} contract:`)} ${url(other)}
|
|
35803
35923
|
`);
|
|
35804
35924
|
put("\n");
|
|
35805
35925
|
} catch {
|
|
35806
|
-
put(` ${
|
|
35926
|
+
put(` ${import_picocolors7.default.red("\u2715")} could not fetch the contract; the URLs:
|
|
35807
35927
|
`);
|
|
35808
|
-
for (const l of LANE_ORDER) put(` ${
|
|
35928
|
+
for (const l of LANE_ORDER) put(` ${import_picocolors7.default.cyan(LANES[l].name.padEnd(16))} ${url(l)}
|
|
35809
35929
|
`);
|
|
35810
35930
|
put("\n");
|
|
35811
35931
|
}
|
|
@@ -35815,7 +35935,7 @@ async function onboard(opts = {}) {
|
|
|
35815
35935
|
const { w, put } = banner();
|
|
35816
35936
|
const existing = await loadProfile(profileName).catch(() => null);
|
|
35817
35937
|
if (existing) {
|
|
35818
|
-
put(` ${
|
|
35938
|
+
put(` ${import_picocolors7.default.green("\u2713")} already paired as ${import_picocolors7.default.bold(existing.walletAddress ?? existing.userId)}
|
|
35819
35939
|
|
|
35820
35940
|
`);
|
|
35821
35941
|
}
|
|
@@ -35823,23 +35943,25 @@ async function onboard(opts = {}) {
|
|
|
35823
35943
|
put(` No terminal attached, so no menu. The machine door:
|
|
35824
35944
|
|
|
35825
35945
|
`);
|
|
35826
|
-
put(` agentgates compute plans --json ${
|
|
35946
|
+
put(` agentgates compute plans --json ${import_picocolors7.default.dim("\xB7 virtual machine pricing, JSON")}
|
|
35827
35947
|
`);
|
|
35828
|
-
put(` agentgates inference models --json ${
|
|
35948
|
+
put(` agentgates inference models --json ${import_picocolors7.default.dim("\xB7 model pricing, JSON; --tier --tag --org --search filter it")}
|
|
35829
35949
|
`);
|
|
35830
|
-
put(` agentgates phone pricing --json ${
|
|
35950
|
+
put(` agentgates phone pricing --json ${import_picocolors7.default.dim("\xB7 number plans, usage and payphone windows, JSON")}
|
|
35831
35951
|
`);
|
|
35832
|
-
put(`
|
|
35952
|
+
put(` agentgates email pricing --json ${import_picocolors7.default.dim("\xB7 the free inbox, plans and per-send price, JSON")}
|
|
35833
35953
|
`);
|
|
35834
|
-
put(` ${CREATORS_ORIGIN}/api/
|
|
35954
|
+
put(` ${CREATORS_ORIGIN}/api/compute/docs ${import_picocolors7.default.dim("\xB7 the buy/read/renew/destroy contract")}
|
|
35835
35955
|
`);
|
|
35836
|
-
put(` ${CREATORS_ORIGIN}/api/
|
|
35956
|
+
put(` ${CREATORS_ORIGIN}/api/inference/docs ${import_picocolors7.default.dim("\xB7 the chat contract, x402 or Bearer")}
|
|
35837
35957
|
`);
|
|
35838
|
-
put(` ${CREATORS_ORIGIN}/
|
|
35958
|
+
put(` ${CREATORS_ORIGIN}/api/identity/docs ${import_picocolors7.default.dim("\xB7 the phone and email contract: plans, inboxes, the booth")}
|
|
35959
|
+
`);
|
|
35960
|
+
put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors7.default.dim("\xB7 the whole surface")}
|
|
35839
35961
|
|
|
35840
35962
|
`);
|
|
35841
35963
|
if (!existing) {
|
|
35842
|
-
put(` Pairing a wallet needs a human at a browser: ${
|
|
35964
|
+
put(` Pairing a wallet needs a human at a browser: ${import_picocolors7.default.bold("agentgates onboard")} in a real terminal.
|
|
35843
35965
|
|
|
35844
35966
|
`);
|
|
35845
35967
|
}
|
|
@@ -35860,7 +35982,7 @@ async function onboard(opts = {}) {
|
|
|
35860
35982
|
const fallback = first ? "1" : exitDefault;
|
|
35861
35983
|
let choice;
|
|
35862
35984
|
try {
|
|
35863
|
-
choice = (await rl.question(` ${
|
|
35985
|
+
choice = (await rl.question(` ${import_picocolors7.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
|
|
35864
35986
|
} catch {
|
|
35865
35987
|
if (first) w?.stop();
|
|
35866
35988
|
process.stdout.write("\n");
|
|
@@ -35884,7 +36006,7 @@ async function onboard(opts = {}) {
|
|
|
35884
36006
|
await runLoginFlow({ profile: profileName, jsonMode: false, ttyHeader: "Pairing this terminal with your wallet\u2026" });
|
|
35885
36007
|
process.stdout.write("\n");
|
|
35886
36008
|
} catch {
|
|
35887
|
-
plain(` ${
|
|
36009
|
+
plain(` ${import_picocolors7.default.red("\u2715")} pairing didn't complete
|
|
35888
36010
|
|
|
35889
36011
|
`);
|
|
35890
36012
|
}
|
|
@@ -35893,7 +36015,7 @@ async function onboard(opts = {}) {
|
|
|
35893
36015
|
try {
|
|
35894
36016
|
await computePlans({});
|
|
35895
36017
|
} catch {
|
|
35896
|
-
plain(` ${
|
|
36018
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the compute catalog
|
|
35897
36019
|
|
|
35898
36020
|
`);
|
|
35899
36021
|
}
|
|
@@ -35902,7 +36024,7 @@ async function onboard(opts = {}) {
|
|
|
35902
36024
|
try {
|
|
35903
36025
|
await inferenceModels({});
|
|
35904
36026
|
} catch {
|
|
35905
|
-
plain(` ${
|
|
36027
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the model catalog
|
|
35906
36028
|
|
|
35907
36029
|
`);
|
|
35908
36030
|
}
|
|
@@ -35911,7 +36033,16 @@ async function onboard(opts = {}) {
|
|
|
35911
36033
|
try {
|
|
35912
36034
|
await phonePricing({});
|
|
35913
36035
|
} catch {
|
|
35914
|
-
plain(` ${
|
|
36036
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the phone catalog
|
|
36037
|
+
|
|
36038
|
+
`);
|
|
36039
|
+
}
|
|
36040
|
+
break;
|
|
36041
|
+
case "email":
|
|
36042
|
+
try {
|
|
36043
|
+
await emailPricing({});
|
|
36044
|
+
} catch {
|
|
36045
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the email catalog
|
|
35915
36046
|
|
|
35916
36047
|
`);
|
|
35917
36048
|
}
|
|
@@ -35927,28 +36058,30 @@ async function onboard(opts = {}) {
|
|
|
35927
36058
|
}
|
|
35928
36059
|
}
|
|
35929
36060
|
function printNext(put) {
|
|
35930
|
-
put(` ${
|
|
36061
|
+
put(` ${import_picocolors7.default.dim("agentgates compute plans")} ${import_picocolors7.default.dim("\xB7 virtual machines by the hour")}
|
|
36062
|
+
`);
|
|
36063
|
+
put(` ${import_picocolors7.default.dim("agentgates inference models")} ${import_picocolors7.default.dim("\xB7 models by the token")}
|
|
35931
36064
|
`);
|
|
35932
|
-
put(` ${
|
|
36065
|
+
put(` ${import_picocolors7.default.dim("agentgates phone pricing")} ${import_picocolors7.default.dim("\xB7 numbers by the month, calls by the minute")}
|
|
35933
36066
|
`);
|
|
35934
|
-
put(` ${
|
|
36067
|
+
put(` ${import_picocolors7.default.dim("agentgates email pricing")} ${import_picocolors7.default.dim("\xB7 inboxes free on a balance, sends per message")}
|
|
35935
36068
|
`);
|
|
35936
|
-
put(` ${
|
|
36069
|
+
put(` ${import_picocolors7.default.dim("agentgates --help")} ${import_picocolors7.default.dim("\xB7 everything else")}
|
|
35937
36070
|
|
|
35938
36071
|
`);
|
|
35939
36072
|
}
|
|
35940
36073
|
|
|
35941
36074
|
// src/commands/logout.ts
|
|
35942
|
-
var
|
|
36075
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
35943
36076
|
async function logout(opts) {
|
|
35944
36077
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35945
36078
|
const resolved = await resolveProfile(requested);
|
|
35946
36079
|
if (!resolved) {
|
|
35947
|
-
process.stdout.write(
|
|
36080
|
+
process.stdout.write(import_picocolors8.default.dim("Not logged in \u2014 nothing to log out.\n"));
|
|
35948
36081
|
return;
|
|
35949
36082
|
}
|
|
35950
36083
|
if (resolved.autoSelected) {
|
|
35951
|
-
process.stderr.write(
|
|
36084
|
+
process.stderr.write(import_picocolors8.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35952
36085
|
`));
|
|
35953
36086
|
}
|
|
35954
36087
|
const { profile, name: profileName } = resolved;
|
|
@@ -35973,15 +36106,15 @@ async function logout(opts) {
|
|
|
35973
36106
|
const removed = await deleteProfile(profileName);
|
|
35974
36107
|
if (removed) {
|
|
35975
36108
|
process.stdout.write(
|
|
35976
|
-
|
|
36109
|
+
import_picocolors8.default.green(`\u2713 Logged out of profile ${import_picocolors8.default.bold(profileName)}.
|
|
35977
36110
|
`)
|
|
35978
36111
|
);
|
|
35979
36112
|
}
|
|
35980
36113
|
if (serverError) {
|
|
35981
36114
|
process.stderr.write(
|
|
35982
|
-
|
|
36115
|
+
import_picocolors8.default.yellow(
|
|
35983
36116
|
`\u26A0 Couldn't revoke server-side: ${serverError}
|
|
35984
|
-
The local bearer is wiped. If the server still has it, revoke from ${
|
|
36117
|
+
The local bearer is wiped. If the server still has it, revoke from ${import_picocolors8.default.bold("agentgates.ai/settings/pairings")}.
|
|
35985
36118
|
`
|
|
35986
36119
|
)
|
|
35987
36120
|
);
|
|
@@ -35989,16 +36122,16 @@ async function logout(opts) {
|
|
|
35989
36122
|
}
|
|
35990
36123
|
|
|
35991
36124
|
// src/commands/whoami.ts
|
|
35992
|
-
var
|
|
36125
|
+
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
35993
36126
|
async function whoami(opts) {
|
|
35994
36127
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35995
36128
|
const resolved = await resolveProfile(requested);
|
|
35996
36129
|
if (!resolved) {
|
|
35997
|
-
process.stderr.write(
|
|
36130
|
+
process.stderr.write(import_picocolors9.default.red("Not logged in. Run agentgates login first.\n"));
|
|
35998
36131
|
process.exit(2);
|
|
35999
36132
|
}
|
|
36000
36133
|
if (resolved.autoSelected) {
|
|
36001
|
-
process.stderr.write(
|
|
36134
|
+
process.stderr.write(import_picocolors9.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36002
36135
|
`));
|
|
36003
36136
|
}
|
|
36004
36137
|
const { profile, name: profileName } = resolved;
|
|
@@ -36007,7 +36140,7 @@ async function whoami(opts) {
|
|
|
36007
36140
|
profile,
|
|
36008
36141
|
profileName,
|
|
36009
36142
|
jsonMode,
|
|
36010
|
-
ttyHeader:
|
|
36143
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36011
36144
|
fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
|
|
36012
36145
|
});
|
|
36013
36146
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36017,14 +36150,14 @@ async function whoami(opts) {
|
|
|
36017
36150
|
);
|
|
36018
36151
|
process.exit(1);
|
|
36019
36152
|
}
|
|
36020
|
-
process.stderr.write(
|
|
36153
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${outcome.reason}.
|
|
36021
36154
|
`));
|
|
36022
36155
|
process.exit(1);
|
|
36023
36156
|
}
|
|
36024
36157
|
if (outcome.kind === "error") {
|
|
36025
36158
|
const err = outcome.error;
|
|
36026
36159
|
if (err instanceof ApiError) {
|
|
36027
|
-
process.stderr.write(
|
|
36160
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36028
36161
|
`));
|
|
36029
36162
|
process.exit(1);
|
|
36030
36163
|
}
|
|
@@ -36045,7 +36178,7 @@ async function whoami(opts) {
|
|
|
36045
36178
|
process.stdout.write(`Solana ${me.solanaAddress}
|
|
36046
36179
|
`);
|
|
36047
36180
|
}
|
|
36048
|
-
process.stdout.write(`Scopes ${me.scopes.join(", ") ||
|
|
36181
|
+
process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors9.default.dim("(none)")}
|
|
36049
36182
|
`);
|
|
36050
36183
|
const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
|
|
36051
36184
|
const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
|
|
@@ -36062,7 +36195,7 @@ async function whoami(opts) {
|
|
|
36062
36195
|
`
|
|
36063
36196
|
);
|
|
36064
36197
|
process.stdout.write(
|
|
36065
|
-
`Profile ${profileName === DEFAULT_PROFILE ?
|
|
36198
|
+
`Profile ${profileName === DEFAULT_PROFILE ? import_picocolors9.default.dim("(default)") : profileName}
|
|
36066
36199
|
`
|
|
36067
36200
|
);
|
|
36068
36201
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36076,7 +36209,7 @@ function formatDate(iso) {
|
|
|
36076
36209
|
}
|
|
36077
36210
|
|
|
36078
36211
|
// src/commands/send.ts
|
|
36079
|
-
var
|
|
36212
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
36080
36213
|
|
|
36081
36214
|
// src/lib/status.ts
|
|
36082
36215
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -36226,11 +36359,11 @@ async function send(amount, asset, opts) {
|
|
|
36226
36359
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36227
36360
|
const resolved = await resolveProfile(requested);
|
|
36228
36361
|
if (!resolved) {
|
|
36229
|
-
process.stderr.write(
|
|
36362
|
+
process.stderr.write(import_picocolors10.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36230
36363
|
process.exit(2);
|
|
36231
36364
|
}
|
|
36232
36365
|
if (resolved.autoSelected) {
|
|
36233
|
-
process.stderr.write(
|
|
36366
|
+
process.stderr.write(import_picocolors10.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36234
36367
|
`));
|
|
36235
36368
|
}
|
|
36236
36369
|
const { profile, name: profileName } = resolved;
|
|
@@ -36239,7 +36372,7 @@ async function send(amount, asset, opts) {
|
|
|
36239
36372
|
const amountNumber = Number(amount);
|
|
36240
36373
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
36241
36374
|
process.stderr.write(
|
|
36242
|
-
|
|
36375
|
+
import_picocolors10.default.red(`\u2715 amount must be a positive number (got ${import_picocolors10.default.bold(amount)}).
|
|
36243
36376
|
`)
|
|
36244
36377
|
);
|
|
36245
36378
|
process.exit(2);
|
|
@@ -36247,23 +36380,23 @@ async function send(amount, asset, opts) {
|
|
|
36247
36380
|
const assetNormalized = asset.toLowerCase();
|
|
36248
36381
|
if (assetNormalized !== "native" && assetNormalized !== "usdc") {
|
|
36249
36382
|
process.stderr.write(
|
|
36250
|
-
|
|
36251
|
-
`\u2715 asset must be ${
|
|
36383
|
+
import_picocolors10.default.red(
|
|
36384
|
+
`\u2715 asset must be ${import_picocolors10.default.bold("native")} or ${import_picocolors10.default.bold("usdc")} (got ${import_picocolors10.default.bold(asset)}).
|
|
36252
36385
|
`
|
|
36253
36386
|
)
|
|
36254
36387
|
);
|
|
36255
36388
|
process.exit(2);
|
|
36256
36389
|
}
|
|
36257
36390
|
if (!opts.to || opts.to.trim() === "") {
|
|
36258
|
-
process.stderr.write(
|
|
36391
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 --to <address> is required.
|
|
36259
36392
|
`));
|
|
36260
36393
|
process.exit(2);
|
|
36261
36394
|
}
|
|
36262
36395
|
if (isSolanaChainAlias(opts.chain)) {
|
|
36263
36396
|
if (EVM_ADDRESS_RE.test(opts.to)) {
|
|
36264
36397
|
process.stderr.write(
|
|
36265
|
-
|
|
36266
|
-
`\u2715 --to looks like an EVM address (0x-hex), but --chain is ${
|
|
36398
|
+
import_picocolors10.default.red(
|
|
36399
|
+
`\u2715 --to looks like an EVM address (0x-hex), but --chain is ${import_picocolors10.default.bold("solana")}. Pass a base58 Solana pubkey, or pick an EVM chain.
|
|
36267
36400
|
`
|
|
36268
36401
|
)
|
|
36269
36402
|
);
|
|
@@ -36271,10 +36404,10 @@ async function send(amount, asset, opts) {
|
|
|
36271
36404
|
}
|
|
36272
36405
|
if (!SOLANA_ADDRESS_RE.test(opts.to)) {
|
|
36273
36406
|
process.stderr.write(
|
|
36274
|
-
|
|
36275
|
-
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${
|
|
36407
|
+
import_picocolors10.default.red(
|
|
36408
|
+
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${import_picocolors10.default.bold(opts.to)}).
|
|
36276
36409
|
`
|
|
36277
|
-
) +
|
|
36410
|
+
) + import_picocolors10.default.dim(
|
|
36278
36411
|
` SNS resolution is deferred to a future server-side change;
|
|
36279
36412
|
for now Solana sends require the literal pubkey.
|
|
36280
36413
|
`
|
|
@@ -36285,8 +36418,8 @@ async function send(amount, asset, opts) {
|
|
|
36285
36418
|
}
|
|
36286
36419
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
36287
36420
|
process.stderr.write(
|
|
36288
|
-
|
|
36289
|
-
`) +
|
|
36421
|
+
import_picocolors10.default.red(`\u2715 --user-stated <text> is required.
|
|
36422
|
+
`) + import_picocolors10.default.dim(
|
|
36290
36423
|
` This is the trust-gap defense: pass the verbatim user request so
|
|
36291
36424
|
the approval modal can cross-check what the agent thinks the user
|
|
36292
36425
|
asked for vs. the actual decoded transaction.
|
|
@@ -36304,7 +36437,7 @@ async function send(amount, asset, opts) {
|
|
|
36304
36437
|
const n = Number(opts.maxUsd);
|
|
36305
36438
|
if (!Number.isFinite(n) || n <= 0) {
|
|
36306
36439
|
process.stderr.write(
|
|
36307
|
-
|
|
36440
|
+
import_picocolors10.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
|
|
36308
36441
|
`)
|
|
36309
36442
|
);
|
|
36310
36443
|
process.exit(2);
|
|
@@ -36346,7 +36479,7 @@ async function send(amount, asset, opts) {
|
|
|
36346
36479
|
profile: profileName,
|
|
36347
36480
|
jsonMode,
|
|
36348
36481
|
origin: activeProfile.mcpOrigin,
|
|
36349
|
-
ttyHeader:
|
|
36482
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
36350
36483
|
});
|
|
36351
36484
|
} catch (reloginErr) {
|
|
36352
36485
|
if (jsonMode) {
|
|
@@ -36358,7 +36491,7 @@ async function send(amount, asset, opts) {
|
|
|
36358
36491
|
process.exit(1);
|
|
36359
36492
|
}
|
|
36360
36493
|
process.stderr.write(
|
|
36361
|
-
|
|
36494
|
+
import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36362
36495
|
`)
|
|
36363
36496
|
);
|
|
36364
36497
|
process.exit(1);
|
|
@@ -36382,7 +36515,7 @@ async function send(amount, asset, opts) {
|
|
|
36382
36515
|
process.exit(1);
|
|
36383
36516
|
}
|
|
36384
36517
|
process.stderr.write(
|
|
36385
|
-
|
|
36518
|
+
import_picocolors10.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
36386
36519
|
`)
|
|
36387
36520
|
);
|
|
36388
36521
|
process.exit(1);
|
|
@@ -36399,7 +36532,7 @@ async function send(amount, asset, opts) {
|
|
|
36399
36532
|
});
|
|
36400
36533
|
process.exit(1);
|
|
36401
36534
|
}
|
|
36402
|
-
process.stderr.write(
|
|
36535
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36403
36536
|
`));
|
|
36404
36537
|
process.exit(1);
|
|
36405
36538
|
} else {
|
|
@@ -36425,17 +36558,17 @@ async function send(amount, asset, opts) {
|
|
|
36425
36558
|
if (proposed.detail) {
|
|
36426
36559
|
const d = proposed.detail;
|
|
36427
36560
|
process.stderr.write(
|
|
36428
|
-
|
|
36561
|
+
import_picocolors10.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
|
|
36429
36562
|
`
|
|
36430
36563
|
);
|
|
36431
36564
|
} else {
|
|
36432
|
-
process.stderr.write(
|
|
36565
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${proposed.reason}
|
|
36433
36566
|
`));
|
|
36434
36567
|
}
|
|
36435
36568
|
if (proposed.upgrade_url) {
|
|
36436
36569
|
process.stderr.write(
|
|
36437
36570
|
` Open this to grant access, then re-run the command:
|
|
36438
|
-
${
|
|
36571
|
+
${import_picocolors10.default.cyan(proposed.upgrade_url)}
|
|
36439
36572
|
`
|
|
36440
36573
|
);
|
|
36441
36574
|
}
|
|
@@ -36445,21 +36578,21 @@ async function send(amount, asset, opts) {
|
|
|
36445
36578
|
const a = proposed.recommended_actions[i];
|
|
36446
36579
|
process.stderr.write(` ${i + 1}. ${a.label}
|
|
36447
36580
|
`);
|
|
36448
|
-
if (a.reasoning) process.stderr.write(
|
|
36581
|
+
if (a.reasoning) process.stderr.write(import_picocolors10.default.dim(` ${a.reasoning}
|
|
36449
36582
|
`));
|
|
36450
36583
|
if (a.action_intent && a.action_intent.external_url) {
|
|
36451
36584
|
process.stderr.write(
|
|
36452
|
-
` ${
|
|
36585
|
+
` ${import_picocolors10.default.cyan(a.action_intent.external_url)}
|
|
36453
36586
|
`
|
|
36454
36587
|
);
|
|
36455
36588
|
}
|
|
36456
36589
|
}
|
|
36457
36590
|
}
|
|
36458
36591
|
if (proposed.suggestions && proposed.suggestions.length > 0) {
|
|
36459
|
-
process.stderr.write(
|
|
36592
|
+
process.stderr.write(import_picocolors10.default.dim("\n Other ways to fund:\n"));
|
|
36460
36593
|
for (const s of proposed.suggestions) {
|
|
36461
36594
|
if (s.kind === "ask_user") continue;
|
|
36462
|
-
process.stderr.write(
|
|
36595
|
+
process.stderr.write(import_picocolors10.default.dim(` \u2022 ${s.label}
|
|
36463
36596
|
`));
|
|
36464
36597
|
}
|
|
36465
36598
|
}
|
|
@@ -36486,8 +36619,8 @@ async function send(amount, asset, opts) {
|
|
|
36486
36619
|
} else {
|
|
36487
36620
|
process.stdout.write(
|
|
36488
36621
|
`
|
|
36489
|
-
${
|
|
36490
|
-
${
|
|
36622
|
+
${import_picocolors10.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
36623
|
+
${import_picocolors10.default.cyan(proposed.approval_url)}
|
|
36491
36624
|
|
|
36492
36625
|
`
|
|
36493
36626
|
);
|
|
@@ -36506,7 +36639,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36506
36639
|
if (jsonMode) {
|
|
36507
36640
|
emitNdjson({ status: s.status, intent_id: s.approval_id });
|
|
36508
36641
|
} else {
|
|
36509
|
-
process.stdout.write(` ${describeStatus(s.status)}${
|
|
36642
|
+
process.stdout.write(` ${describeStatus(s.status)}${import_picocolors10.default.dim("\u2026")}\r`);
|
|
36510
36643
|
}
|
|
36511
36644
|
}
|
|
36512
36645
|
});
|
|
@@ -36520,7 +36653,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36520
36653
|
profile: profileName,
|
|
36521
36654
|
jsonMode,
|
|
36522
36655
|
origin: activeProfile.mcpOrigin,
|
|
36523
|
-
ttyHeader:
|
|
36656
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
|
|
36524
36657
|
});
|
|
36525
36658
|
} catch (reloginErr) {
|
|
36526
36659
|
if (jsonMode) {
|
|
@@ -36533,7 +36666,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36533
36666
|
process.exit(1);
|
|
36534
36667
|
}
|
|
36535
36668
|
process.stderr.write(
|
|
36536
|
-
"\n" +
|
|
36669
|
+
"\n" + import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36537
36670
|
`)
|
|
36538
36671
|
);
|
|
36539
36672
|
process.exit(1);
|
|
@@ -36551,7 +36684,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36551
36684
|
process.exit(1);
|
|
36552
36685
|
}
|
|
36553
36686
|
process.stderr.write(
|
|
36554
|
-
"\n" +
|
|
36687
|
+
"\n" + import_picocolors10.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
36555
36688
|
`)
|
|
36556
36689
|
);
|
|
36557
36690
|
process.exit(1);
|
|
@@ -36567,7 +36700,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36567
36700
|
process.exit(1);
|
|
36568
36701
|
}
|
|
36569
36702
|
process.stderr.write(
|
|
36570
|
-
"\n" +
|
|
36703
|
+
"\n" + import_picocolors10.default.red(`\u2715 Status poll failed: ${err.message}
|
|
36571
36704
|
`)
|
|
36572
36705
|
);
|
|
36573
36706
|
process.exit(1);
|
|
@@ -36587,19 +36720,19 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36587
36720
|
}
|
|
36588
36721
|
process.stdout.write("\n");
|
|
36589
36722
|
if (final.status === "mined") {
|
|
36590
|
-
process.stdout.write(
|
|
36723
|
+
process.stdout.write(import_picocolors10.default.green("\u2713 Mined.") + "\n");
|
|
36591
36724
|
if (final.tx_hash) {
|
|
36592
36725
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
36593
36726
|
`);
|
|
36594
36727
|
}
|
|
36595
36728
|
if (explorer) {
|
|
36596
|
-
process.stdout.write(` Explorer ${
|
|
36729
|
+
process.stdout.write(` Explorer ${import_picocolors10.default.cyan(explorer)}
|
|
36597
36730
|
`);
|
|
36598
36731
|
}
|
|
36599
36732
|
process.exit(0);
|
|
36600
36733
|
}
|
|
36601
36734
|
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}`;
|
|
36602
|
-
process.stderr.write(
|
|
36735
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${label}.
|
|
36603
36736
|
`));
|
|
36604
36737
|
process.exit(1);
|
|
36605
36738
|
}
|
|
@@ -36627,7 +36760,7 @@ function describeStatus(s) {
|
|
|
36627
36760
|
}
|
|
36628
36761
|
|
|
36629
36762
|
// src/commands/status.ts
|
|
36630
|
-
var
|
|
36763
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
36631
36764
|
var WATCH_GIVEUP_MS = 10 * 6e4;
|
|
36632
36765
|
function explorerUrl2(chainId, hash) {
|
|
36633
36766
|
switch (chainId) {
|
|
@@ -36645,17 +36778,17 @@ function explorerUrl2(chainId, hash) {
|
|
|
36645
36778
|
}
|
|
36646
36779
|
async function status(intentId, opts) {
|
|
36647
36780
|
if (!intentId || intentId.trim() === "") {
|
|
36648
|
-
process.stderr.write(
|
|
36781
|
+
process.stderr.write(import_picocolors11.default.red("\u2715 Missing intent id.\n"));
|
|
36649
36782
|
process.exit(2);
|
|
36650
36783
|
}
|
|
36651
36784
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36652
36785
|
const resolved = await resolveProfile(requested);
|
|
36653
36786
|
if (!resolved) {
|
|
36654
|
-
process.stderr.write(
|
|
36787
|
+
process.stderr.write(import_picocolors11.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36655
36788
|
process.exit(2);
|
|
36656
36789
|
}
|
|
36657
36790
|
if (resolved.autoSelected) {
|
|
36658
|
-
process.stderr.write(
|
|
36791
|
+
process.stderr.write(import_picocolors11.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36659
36792
|
`));
|
|
36660
36793
|
}
|
|
36661
36794
|
const { profile, name: profileName } = resolved;
|
|
@@ -36664,7 +36797,7 @@ async function status(intentId, opts) {
|
|
|
36664
36797
|
profile,
|
|
36665
36798
|
profileName,
|
|
36666
36799
|
jsonMode,
|
|
36667
|
-
ttyHeader:
|
|
36800
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36668
36801
|
fn: (bearer, origin) => fetchStatus({ intentId, bearer, origin })
|
|
36669
36802
|
});
|
|
36670
36803
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36674,7 +36807,7 @@ async function status(intentId, opts) {
|
|
|
36674
36807
|
);
|
|
36675
36808
|
process.exit(1);
|
|
36676
36809
|
}
|
|
36677
|
-
process.stderr.write(
|
|
36810
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${outcome.reason}.
|
|
36678
36811
|
`));
|
|
36679
36812
|
process.exit(1);
|
|
36680
36813
|
}
|
|
@@ -36682,11 +36815,11 @@ async function status(intentId, opts) {
|
|
|
36682
36815
|
const err = outcome.error;
|
|
36683
36816
|
if (err instanceof ApiError) {
|
|
36684
36817
|
if (err.status === 404) {
|
|
36685
|
-
process.stderr.write(
|
|
36818
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 No intent with id ${intentId}.
|
|
36686
36819
|
`));
|
|
36687
36820
|
process.exit(1);
|
|
36688
36821
|
}
|
|
36689
|
-
process.stderr.write(
|
|
36822
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36690
36823
|
`));
|
|
36691
36824
|
process.exit(1);
|
|
36692
36825
|
}
|
|
@@ -36697,7 +36830,7 @@ async function status(intentId, opts) {
|
|
|
36697
36830
|
if (opts.watch && !isTerminalStatus(snap.status)) {
|
|
36698
36831
|
if (!jsonMode) {
|
|
36699
36832
|
printSnap(snap);
|
|
36700
|
-
process.stdout.write(
|
|
36833
|
+
process.stdout.write(import_picocolors11.default.dim("Watching\u2026\n"));
|
|
36701
36834
|
}
|
|
36702
36835
|
const runWatchPoll = (p) => streamStatusUntilTerminal({
|
|
36703
36836
|
intentId,
|
|
@@ -36708,7 +36841,7 @@ async function status(intentId, opts) {
|
|
|
36708
36841
|
giveUpMs: WATCH_GIVEUP_MS,
|
|
36709
36842
|
onTick: (s) => {
|
|
36710
36843
|
if (!jsonMode) {
|
|
36711
|
-
process.stdout.write(` ${
|
|
36844
|
+
process.stdout.write(` ${import_picocolors11.default.dim("\u2192")} ${s.status}
|
|
36712
36845
|
`);
|
|
36713
36846
|
}
|
|
36714
36847
|
}
|
|
@@ -36723,7 +36856,7 @@ async function status(intentId, opts) {
|
|
|
36723
36856
|
profile: profileName,
|
|
36724
36857
|
jsonMode,
|
|
36725
36858
|
origin: activeProfile.mcpOrigin,
|
|
36726
|
-
ttyHeader:
|
|
36859
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
|
|
36727
36860
|
});
|
|
36728
36861
|
} catch (reloginErr) {
|
|
36729
36862
|
if (jsonMode) {
|
|
@@ -36737,7 +36870,7 @@ async function status(intentId, opts) {
|
|
|
36737
36870
|
process.exit(1);
|
|
36738
36871
|
}
|
|
36739
36872
|
process.stderr.write(
|
|
36740
|
-
|
|
36873
|
+
import_picocolors11.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36741
36874
|
`)
|
|
36742
36875
|
);
|
|
36743
36876
|
process.exit(1);
|
|
@@ -36745,12 +36878,12 @@ async function status(intentId, opts) {
|
|
|
36745
36878
|
try {
|
|
36746
36879
|
final = await runWatchPoll(activeProfile);
|
|
36747
36880
|
} catch (retryErr) {
|
|
36748
|
-
process.stderr.write(
|
|
36881
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${retryErr.message}
|
|
36749
36882
|
`));
|
|
36750
36883
|
process.exit(1);
|
|
36751
36884
|
}
|
|
36752
36885
|
} else {
|
|
36753
|
-
process.stderr.write(
|
|
36886
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message}
|
|
36754
36887
|
`));
|
|
36755
36888
|
process.exit(1);
|
|
36756
36889
|
}
|
|
@@ -36771,7 +36904,7 @@ async function status(intentId, opts) {
|
|
|
36771
36904
|
}
|
|
36772
36905
|
function printSnap(s) {
|
|
36773
36906
|
const explorer = s.tx_hash ? explorerUrl2(s.chain_id, s.tx_hash) : null;
|
|
36774
|
-
const colorFn = s.status === "mined" ?
|
|
36907
|
+
const colorFn = s.status === "mined" ? import_picocolors11.default.green : s.status === "rejected" || s.status === "expired" || s.status === "failed" ? import_picocolors11.default.red : import_picocolors11.default.cyan;
|
|
36775
36908
|
process.stdout.write(`Intent ${s.approval_id}
|
|
36776
36909
|
`);
|
|
36777
36910
|
process.stdout.write(`Status ${colorFn(s.status)}
|
|
@@ -36786,12 +36919,12 @@ function printSnap(s) {
|
|
|
36786
36919
|
process.stdout.write(`Tx ${s.tx_hash}
|
|
36787
36920
|
`);
|
|
36788
36921
|
if (explorer) {
|
|
36789
|
-
process.stdout.write(`Explorer ${
|
|
36922
|
+
process.stdout.write(`Explorer ${import_picocolors11.default.cyan(explorer)}
|
|
36790
36923
|
`);
|
|
36791
36924
|
}
|
|
36792
36925
|
}
|
|
36793
36926
|
if (!isTerminalStatus(s.status)) {
|
|
36794
|
-
process.stdout.write(`Approve ${
|
|
36927
|
+
process.stdout.write(`Approve ${import_picocolors11.default.cyan(s.approval_url)}
|
|
36795
36928
|
`);
|
|
36796
36929
|
}
|
|
36797
36930
|
process.stdout.write(`Created ${formatDate2(s.created_at)}
|
|
@@ -36808,7 +36941,7 @@ function formatDate2(iso) {
|
|
|
36808
36941
|
}
|
|
36809
36942
|
|
|
36810
36943
|
// src/commands/balance.ts
|
|
36811
|
-
var
|
|
36944
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
36812
36945
|
var CHAIN_ALIASES = {
|
|
36813
36946
|
"1": 1,
|
|
36814
36947
|
ethereum: 1,
|
|
@@ -36831,11 +36964,11 @@ async function balance(opts) {
|
|
|
36831
36964
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36832
36965
|
const resolved = await resolveProfile(requested);
|
|
36833
36966
|
if (!resolved) {
|
|
36834
|
-
process.stderr.write(
|
|
36967
|
+
process.stderr.write(import_picocolors12.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36835
36968
|
process.exit(2);
|
|
36836
36969
|
}
|
|
36837
36970
|
if (resolved.autoSelected) {
|
|
36838
|
-
process.stderr.write(
|
|
36971
|
+
process.stderr.write(import_picocolors12.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36839
36972
|
`));
|
|
36840
36973
|
}
|
|
36841
36974
|
const { profile, name: profileName } = resolved;
|
|
@@ -36845,8 +36978,8 @@ async function balance(opts) {
|
|
|
36845
36978
|
const id = CHAIN_ALIASES[key];
|
|
36846
36979
|
if (id === void 0) {
|
|
36847
36980
|
process.stderr.write(
|
|
36848
|
-
|
|
36849
|
-
`\u2715 Unknown chain ${
|
|
36981
|
+
import_picocolors12.default.red(
|
|
36982
|
+
`\u2715 Unknown chain ${import_picocolors12.default.bold(opts.chain)}. Supported: ${import_picocolors12.default.bold("1/ethereum")}, ${import_picocolors12.default.bold("137/polygon")}, ${import_picocolors12.default.bold("8453/base")}, ${import_picocolors12.default.bold("42161/arbitrum")}, ${import_picocolors12.default.bold("900/solana")}.
|
|
36850
36983
|
`
|
|
36851
36984
|
)
|
|
36852
36985
|
);
|
|
@@ -36859,7 +36992,7 @@ async function balance(opts) {
|
|
|
36859
36992
|
profile,
|
|
36860
36993
|
profileName,
|
|
36861
36994
|
jsonMode,
|
|
36862
|
-
ttyHeader:
|
|
36995
|
+
ttyHeader: import_picocolors12.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36863
36996
|
fn: (bearer, origin) => apiFetch("/api/balances", { bearer, origin })
|
|
36864
36997
|
});
|
|
36865
36998
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36869,14 +37002,14 @@ async function balance(opts) {
|
|
|
36869
37002
|
);
|
|
36870
37003
|
process.exit(1);
|
|
36871
37004
|
}
|
|
36872
|
-
process.stderr.write(
|
|
37005
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${outcome.reason}.
|
|
36873
37006
|
`));
|
|
36874
37007
|
process.exit(1);
|
|
36875
37008
|
}
|
|
36876
37009
|
if (outcome.kind === "error") {
|
|
36877
37010
|
const err = outcome.error;
|
|
36878
37011
|
if (err instanceof ApiError) {
|
|
36879
|
-
process.stderr.write(
|
|
37012
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36880
37013
|
`));
|
|
36881
37014
|
process.exit(1);
|
|
36882
37015
|
}
|
|
@@ -36906,7 +37039,7 @@ async function balance(opts) {
|
|
|
36906
37039
|
}
|
|
36907
37040
|
if (filtered.length === 0) {
|
|
36908
37041
|
process.stdout.write(
|
|
36909
|
-
|
|
37042
|
+
import_picocolors12.default.dim(
|
|
36910
37043
|
chainFilter !== null ? `No balances on chain ${chainFilter}.
|
|
36911
37044
|
` : `No chain balances returned.
|
|
36912
37045
|
`
|
|
@@ -36918,7 +37051,7 @@ async function balance(opts) {
|
|
|
36918
37051
|
const errorLines = [];
|
|
36919
37052
|
for (const c of filtered) {
|
|
36920
37053
|
if (c.error) {
|
|
36921
|
-
errorLines.push(`${c.chainName} ${
|
|
37054
|
+
errorLines.push(`${c.chainName} ${import_picocolors12.default.red(`(read failed: ${c.error})`)}`);
|
|
36922
37055
|
continue;
|
|
36923
37056
|
}
|
|
36924
37057
|
if (c.native.balance > 0) {
|
|
@@ -36939,7 +37072,7 @@ async function balance(opts) {
|
|
|
36939
37072
|
}
|
|
36940
37073
|
}
|
|
36941
37074
|
if (rows.length === 0 && errorLines.length === 0) {
|
|
36942
|
-
process.stdout.write(
|
|
37075
|
+
process.stdout.write(import_picocolors12.default.dim(`All balances are zero.
|
|
36943
37076
|
`));
|
|
36944
37077
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
36945
37078
|
return;
|
|
@@ -36949,7 +37082,7 @@ async function balance(opts) {
|
|
|
36949
37082
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36950
37083
|
const colBalance = Math.max(7, ...rows.map((r) => r.balance.length));
|
|
36951
37084
|
const header = "Chain".padEnd(colChain) + " " + "Asset".padEnd(colAsset) + " " + "Balance".padStart(colBalance);
|
|
36952
|
-
process.stdout.write(
|
|
37085
|
+
process.stdout.write(import_picocolors12.default.dim(header) + "\n");
|
|
36953
37086
|
for (const r of rows) {
|
|
36954
37087
|
process.stdout.write(
|
|
36955
37088
|
r.chain.padEnd(colChain) + " " + r.asset.padEnd(colAsset) + " " + r.balance.padStart(colBalance) + "\n"
|
|
@@ -36962,7 +37095,7 @@ async function balance(opts) {
|
|
|
36962
37095
|
`);
|
|
36963
37096
|
}
|
|
36964
37097
|
if (res.fetched_at) {
|
|
36965
|
-
process.stdout.write("\n" +
|
|
37098
|
+
process.stdout.write("\n" + import_picocolors12.default.dim(`Fetched ${res.fetched_at}
|
|
36966
37099
|
`));
|
|
36967
37100
|
}
|
|
36968
37101
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36975,18 +37108,18 @@ function formatBalance(value, decimals) {
|
|
|
36975
37108
|
}
|
|
36976
37109
|
|
|
36977
37110
|
// src/commands/history.ts
|
|
36978
|
-
var
|
|
37111
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
36979
37112
|
var DEFAULT_LIMIT = 20;
|
|
36980
37113
|
var SERVER_MAX_LIMIT = 100;
|
|
36981
37114
|
async function history(opts) {
|
|
36982
37115
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36983
37116
|
const resolved = await resolveProfile(requested);
|
|
36984
37117
|
if (!resolved) {
|
|
36985
|
-
process.stderr.write(
|
|
37118
|
+
process.stderr.write(import_picocolors13.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36986
37119
|
process.exit(2);
|
|
36987
37120
|
}
|
|
36988
37121
|
if (resolved.autoSelected) {
|
|
36989
|
-
process.stderr.write(
|
|
37122
|
+
process.stderr.write(import_picocolors13.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36990
37123
|
`));
|
|
36991
37124
|
}
|
|
36992
37125
|
const { profile, name: profileName } = resolved;
|
|
@@ -36995,14 +37128,14 @@ async function history(opts) {
|
|
|
36995
37128
|
const n = Number(opts.limit);
|
|
36996
37129
|
if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
|
|
36997
37130
|
process.stderr.write(
|
|
36998
|
-
|
|
37131
|
+
import_picocolors13.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors13.default.bold(opts.limit)}).
|
|
36999
37132
|
`)
|
|
37000
37133
|
);
|
|
37001
37134
|
process.exit(2);
|
|
37002
37135
|
}
|
|
37003
37136
|
if (n > SERVER_MAX_LIMIT) {
|
|
37004
37137
|
process.stderr.write(
|
|
37005
|
-
|
|
37138
|
+
import_picocolors13.default.red(
|
|
37006
37139
|
`\u2715 --limit max is ${SERVER_MAX_LIMIT} (the server's wallet://history hard cap). Got ${n}.
|
|
37007
37140
|
`
|
|
37008
37141
|
)
|
|
@@ -37016,7 +37149,7 @@ async function history(opts) {
|
|
|
37016
37149
|
profile,
|
|
37017
37150
|
profileName,
|
|
37018
37151
|
jsonMode,
|
|
37019
|
-
ttyHeader:
|
|
37152
|
+
ttyHeader: import_picocolors13.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
37020
37153
|
fn: (bearer, origin) => apiFetch(
|
|
37021
37154
|
`/api/history?limit=${encodeURIComponent(String(limit))}`,
|
|
37022
37155
|
{ bearer, origin }
|
|
@@ -37029,14 +37162,14 @@ async function history(opts) {
|
|
|
37029
37162
|
);
|
|
37030
37163
|
process.exit(1);
|
|
37031
37164
|
}
|
|
37032
|
-
process.stderr.write(
|
|
37165
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${outcome.reason}.
|
|
37033
37166
|
`));
|
|
37034
37167
|
process.exit(1);
|
|
37035
37168
|
}
|
|
37036
37169
|
if (outcome.kind === "error") {
|
|
37037
37170
|
const err = outcome.error;
|
|
37038
37171
|
if (err instanceof ApiError) {
|
|
37039
|
-
process.stderr.write(
|
|
37172
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37040
37173
|
`));
|
|
37041
37174
|
process.exit(1);
|
|
37042
37175
|
}
|
|
@@ -37053,7 +37186,7 @@ async function history(opts) {
|
|
|
37053
37186
|
return;
|
|
37054
37187
|
}
|
|
37055
37188
|
if (res.txs.length === 0) {
|
|
37056
|
-
process.stdout.write(
|
|
37189
|
+
process.stdout.write(import_picocolors13.default.dim(`No activity yet.
|
|
37057
37190
|
`));
|
|
37058
37191
|
return;
|
|
37059
37192
|
}
|
|
@@ -37073,7 +37206,7 @@ async function history(opts) {
|
|
|
37073
37206
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
37074
37207
|
const colTo = Math.max(2, ...rows.map((r) => r.to.length));
|
|
37075
37208
|
const header = "When".padEnd(colWhen) + " " + "Chain".padEnd(colChain) + " " + "Type".padEnd(colType) + " " + "Amount".padStart(colAmount) + " " + "Asset".padEnd(colAsset) + " " + "To".padEnd(colTo) + " Hash";
|
|
37076
|
-
process.stdout.write(
|
|
37209
|
+
process.stdout.write(import_picocolors13.default.dim(header) + "\n");
|
|
37077
37210
|
for (const r of rows) {
|
|
37078
37211
|
process.stdout.write(
|
|
37079
37212
|
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"
|
|
@@ -37081,7 +37214,7 @@ async function history(opts) {
|
|
|
37081
37214
|
}
|
|
37082
37215
|
if (res.fetched_at) {
|
|
37083
37216
|
process.stdout.write(
|
|
37084
|
-
"\n" +
|
|
37217
|
+
"\n" + import_picocolors13.default.dim(
|
|
37085
37218
|
`Showing ${rows.length} of limit ${res.limit ?? limit} \xB7 fetched ${res.fetched_at}
|
|
37086
37219
|
`
|
|
37087
37220
|
)
|
|
@@ -37168,10 +37301,10 @@ function prettyType(activityType, status2) {
|
|
|
37168
37301
|
}
|
|
37169
37302
|
|
|
37170
37303
|
// src/commands/swap.ts
|
|
37171
|
-
var
|
|
37304
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
37172
37305
|
|
|
37173
37306
|
// src/lib/intent-flow.ts
|
|
37174
|
-
var
|
|
37307
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
37175
37308
|
var STREAM_GIVEUP_MS = 10 * 6e4;
|
|
37176
37309
|
var SOLANA_CHAIN_ID2 = 900;
|
|
37177
37310
|
function isBlocked2(r) {
|
|
@@ -37246,7 +37379,7 @@ async function runIntentFlow(opts) {
|
|
|
37246
37379
|
profile: opts.profileName,
|
|
37247
37380
|
jsonMode: opts.jsonMode,
|
|
37248
37381
|
origin: activeProfile.mcpOrigin,
|
|
37249
|
-
ttyHeader:
|
|
37382
|
+
ttyHeader: import_picocolors14.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
37250
37383
|
});
|
|
37251
37384
|
} catch (reloginErr) {
|
|
37252
37385
|
if (opts.jsonMode) {
|
|
@@ -37258,7 +37391,7 @@ async function runIntentFlow(opts) {
|
|
|
37258
37391
|
process.exit(1);
|
|
37259
37392
|
}
|
|
37260
37393
|
process.stderr.write(
|
|
37261
|
-
|
|
37394
|
+
import_picocolors14.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37262
37395
|
`)
|
|
37263
37396
|
);
|
|
37264
37397
|
process.exit(1);
|
|
@@ -37282,7 +37415,7 @@ async function runIntentFlow(opts) {
|
|
|
37282
37415
|
process.exit(1);
|
|
37283
37416
|
}
|
|
37284
37417
|
process.stderr.write(
|
|
37285
|
-
|
|
37418
|
+
import_picocolors14.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
37286
37419
|
`)
|
|
37287
37420
|
);
|
|
37288
37421
|
process.exit(1);
|
|
@@ -37299,7 +37432,7 @@ async function runIntentFlow(opts) {
|
|
|
37299
37432
|
});
|
|
37300
37433
|
process.exit(1);
|
|
37301
37434
|
}
|
|
37302
|
-
process.stderr.write(
|
|
37435
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37303
37436
|
`));
|
|
37304
37437
|
process.exit(1);
|
|
37305
37438
|
} else {
|
|
@@ -37321,18 +37454,18 @@ async function runIntentFlow(opts) {
|
|
|
37321
37454
|
});
|
|
37322
37455
|
process.exit(1);
|
|
37323
37456
|
}
|
|
37324
|
-
process.stderr.write(
|
|
37457
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
|
|
37325
37458
|
`));
|
|
37326
37459
|
if (proposed.upgrade_url) {
|
|
37327
37460
|
process.stderr.write(
|
|
37328
37461
|
` Open this to grant access, then re-run the command:
|
|
37329
|
-
${
|
|
37462
|
+
${import_picocolors14.default.cyan(proposed.upgrade_url)}
|
|
37330
37463
|
`
|
|
37331
37464
|
);
|
|
37332
37465
|
}
|
|
37333
37466
|
if (proposed.recommended_actions && proposed.recommended_actions.length > 0) {
|
|
37334
37467
|
process.stderr.write(
|
|
37335
|
-
|
|
37468
|
+
import_picocolors14.default.dim(
|
|
37336
37469
|
` Suggested actions:
|
|
37337
37470
|
` + proposed.recommended_actions.map((a) => ` \u2022 ${JSON.stringify(a)}`).join("\n") + "\n"
|
|
37338
37471
|
)
|
|
@@ -37355,8 +37488,8 @@ async function runIntentFlow(opts) {
|
|
|
37355
37488
|
} else {
|
|
37356
37489
|
process.stdout.write(
|
|
37357
37490
|
`
|
|
37358
|
-
${
|
|
37359
|
-
${
|
|
37491
|
+
${import_picocolors14.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
37492
|
+
${import_picocolors14.default.cyan(proposed.approval_url)}
|
|
37360
37493
|
|
|
37361
37494
|
`
|
|
37362
37495
|
);
|
|
@@ -37378,7 +37511,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37378
37511
|
if (opts.jsonMode) {
|
|
37379
37512
|
emitNdjson2({ status: s.status, intent_id: s.approval_id });
|
|
37380
37513
|
} else {
|
|
37381
|
-
process.stdout.write(` ${describeStatus2(s.status)}${
|
|
37514
|
+
process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors14.default.dim("\u2026")}\r`);
|
|
37382
37515
|
}
|
|
37383
37516
|
}
|
|
37384
37517
|
});
|
|
@@ -37392,7 +37525,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37392
37525
|
profile: opts.profileName,
|
|
37393
37526
|
jsonMode: opts.jsonMode,
|
|
37394
37527
|
origin: activeProfile.mcpOrigin,
|
|
37395
|
-
ttyHeader:
|
|
37528
|
+
ttyHeader: import_picocolors14.default.dim(
|
|
37396
37529
|
"Bearer expired mid-poll \u2014 re-pairing this terminal\u2026"
|
|
37397
37530
|
)
|
|
37398
37531
|
});
|
|
@@ -37407,7 +37540,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37407
37540
|
process.exit(1);
|
|
37408
37541
|
}
|
|
37409
37542
|
process.stderr.write(
|
|
37410
|
-
"\n" +
|
|
37543
|
+
"\n" + import_picocolors14.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37411
37544
|
`)
|
|
37412
37545
|
);
|
|
37413
37546
|
process.exit(1);
|
|
@@ -37425,7 +37558,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37425
37558
|
process.exit(1);
|
|
37426
37559
|
}
|
|
37427
37560
|
process.stderr.write(
|
|
37428
|
-
"\n" +
|
|
37561
|
+
"\n" + import_picocolors14.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
37429
37562
|
`)
|
|
37430
37563
|
);
|
|
37431
37564
|
process.exit(1);
|
|
@@ -37441,7 +37574,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37441
37574
|
process.exit(1);
|
|
37442
37575
|
}
|
|
37443
37576
|
process.stderr.write(
|
|
37444
|
-
"\n" +
|
|
37577
|
+
"\n" + import_picocolors14.default.red(`\u2715 Status poll failed: ${err.message}
|
|
37445
37578
|
`)
|
|
37446
37579
|
);
|
|
37447
37580
|
process.exit(1);
|
|
@@ -37482,39 +37615,39 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37482
37615
|
process.stdout.write("\n");
|
|
37483
37616
|
const printLegJournal = () => {
|
|
37484
37617
|
if (legs.length === 0) return;
|
|
37485
|
-
process.stdout.write(
|
|
37618
|
+
process.stdout.write(import_picocolors14.default.bold(" Legs:\n"));
|
|
37486
37619
|
for (const l of legs) {
|
|
37487
|
-
const line = l.status === "mined" ?
|
|
37620
|
+
const line = l.status === "mined" ? import_picocolors14.default.green(`\u2713 leg ${l.index + 1} mined`) + (l.tx_hash ? import_picocolors14.default.dim(` ${l.tx_hash}`) : "") : l.status === "failed" ? import_picocolors14.default.red(`\u2715 leg ${l.index + 1} failed`) + (l.failure?.message ? ` \u2014 ${l.failure.message}` : "") : l.status === "pending" || l.status === "rendered" ? import_picocolors14.default.dim(`\u2013 leg ${l.index + 1} not run`) : import_picocolors14.default.dim(`\u2026 leg ${l.index + 1} ${l.status}`);
|
|
37488
37621
|
process.stdout.write(` ${line}
|
|
37489
37622
|
`);
|
|
37490
37623
|
}
|
|
37491
37624
|
};
|
|
37492
37625
|
if (final.status === "mined") {
|
|
37493
|
-
process.stdout.write(
|
|
37626
|
+
process.stdout.write(import_picocolors14.default.green("\u2713 Mined.") + "\n");
|
|
37494
37627
|
if (final.tx_hash) {
|
|
37495
37628
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
37496
37629
|
`);
|
|
37497
37630
|
}
|
|
37498
37631
|
if (explorer) {
|
|
37499
|
-
process.stdout.write(` Explorer ${
|
|
37632
|
+
process.stdout.write(` Explorer ${import_picocolors14.default.cyan(explorer)}
|
|
37500
37633
|
`);
|
|
37501
37634
|
}
|
|
37502
37635
|
printLegJournal();
|
|
37503
37636
|
process.exit(0);
|
|
37504
37637
|
}
|
|
37505
37638
|
if (final.status === "failed" && failure?.message) {
|
|
37506
|
-
process.stderr.write(
|
|
37639
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${failure.message}
|
|
37507
37640
|
`));
|
|
37508
37641
|
if (retryCommand) {
|
|
37509
37642
|
process.stderr.write(` Retry:
|
|
37510
|
-
${
|
|
37643
|
+
${import_picocolors14.default.cyan(retryCommand)}
|
|
37511
37644
|
`);
|
|
37512
37645
|
}
|
|
37513
37646
|
printLegJournal();
|
|
37514
37647
|
process.exit(1);
|
|
37515
37648
|
}
|
|
37516
37649
|
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. Re-run the command to retry with fresh parameters" : `Ended in unexpected status: ${final.status}`;
|
|
37517
|
-
process.stderr.write(
|
|
37650
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${label}.
|
|
37518
37651
|
`));
|
|
37519
37652
|
printLegJournal();
|
|
37520
37653
|
process.exit(1);
|
|
@@ -37534,7 +37667,7 @@ function isAsset(v) {
|
|
|
37534
37667
|
return ASSET_VALUES.has(v.toLowerCase());
|
|
37535
37668
|
}
|
|
37536
37669
|
function failArg(msg) {
|
|
37537
|
-
process.stderr.write(
|
|
37670
|
+
process.stderr.write(import_picocolors15.default.red(`\u2715 ${msg}
|
|
37538
37671
|
`));
|
|
37539
37672
|
process.exit(2);
|
|
37540
37673
|
}
|
|
@@ -37542,11 +37675,11 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37542
37675
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37543
37676
|
const resolved = await resolveProfile(requested);
|
|
37544
37677
|
if (!resolved) {
|
|
37545
|
-
process.stderr.write(
|
|
37678
|
+
process.stderr.write(import_picocolors15.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37546
37679
|
process.exit(2);
|
|
37547
37680
|
}
|
|
37548
37681
|
if (resolved.autoSelected) {
|
|
37549
|
-
process.stderr.write(
|
|
37682
|
+
process.stderr.write(import_picocolors15.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37550
37683
|
`));
|
|
37551
37684
|
}
|
|
37552
37685
|
const { profile, name: profileName } = resolved;
|
|
@@ -37554,12 +37687,12 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37554
37687
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37555
37688
|
const amountNumber = Number(amount);
|
|
37556
37689
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37557
|
-
failArg(`amount must be a positive number (got ${
|
|
37690
|
+
failArg(`amount must be a positive number (got ${import_picocolors15.default.bold(amount)}).`);
|
|
37558
37691
|
}
|
|
37559
37692
|
const fromAssetNorm = fromAsset.toLowerCase();
|
|
37560
37693
|
if (!isAsset(fromAssetNorm)) {
|
|
37561
37694
|
failArg(
|
|
37562
|
-
`from-asset must be ${
|
|
37695
|
+
`from-asset must be ${import_picocolors15.default.bold("native")} or ${import_picocolors15.default.bold("usdc")} (got ${import_picocolors15.default.bold(fromAsset)}).`
|
|
37563
37696
|
);
|
|
37564
37697
|
}
|
|
37565
37698
|
if (!opts.toAsset) {
|
|
@@ -37568,7 +37701,7 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37568
37701
|
const toAssetNorm = opts.toAsset.toLowerCase();
|
|
37569
37702
|
if (!isAsset(toAssetNorm)) {
|
|
37570
37703
|
failArg(
|
|
37571
|
-
`--to-asset must be ${
|
|
37704
|
+
`--to-asset must be ${import_picocolors15.default.bold("native")} or ${import_picocolors15.default.bold("usdc")} (got ${import_picocolors15.default.bold(opts.toAsset)}).`
|
|
37572
37705
|
);
|
|
37573
37706
|
}
|
|
37574
37707
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37697,9 +37830,9 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37697
37830
|
}
|
|
37698
37831
|
|
|
37699
37832
|
// src/commands/batch.ts
|
|
37700
|
-
var
|
|
37833
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
37701
37834
|
function failArg2(msg) {
|
|
37702
|
-
process.stderr.write(
|
|
37835
|
+
process.stderr.write(import_picocolors16.default.red(`\u2715 ${msg}
|
|
37703
37836
|
`));
|
|
37704
37837
|
process.exit(2);
|
|
37705
37838
|
}
|
|
@@ -37707,7 +37840,7 @@ async function batch(opts) {
|
|
|
37707
37840
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37708
37841
|
const resolved = await resolveProfile(requested);
|
|
37709
37842
|
if (!resolved) {
|
|
37710
|
-
process.stderr.write(
|
|
37843
|
+
process.stderr.write(import_picocolors16.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37711
37844
|
process.exit(2);
|
|
37712
37845
|
}
|
|
37713
37846
|
const { name: profileName, profile } = resolved;
|
|
@@ -37761,14 +37894,14 @@ async function batch(opts) {
|
|
|
37761
37894
|
}
|
|
37762
37895
|
|
|
37763
37896
|
// src/commands/fund-wallet.ts
|
|
37764
|
-
var
|
|
37897
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
37765
37898
|
var EVM_ADDRESS_RE2 = /^0x[0-9a-fA-F]{40}$/;
|
|
37766
37899
|
var SOLANA_ADDRESS_RE2 = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
37767
37900
|
function isAddressTarget(target) {
|
|
37768
37901
|
return EVM_ADDRESS_RE2.test(target) || SOLANA_ADDRESS_RE2.test(target);
|
|
37769
37902
|
}
|
|
37770
37903
|
function failArg3(msg) {
|
|
37771
|
-
process.stderr.write(
|
|
37904
|
+
process.stderr.write(import_picocolors17.default.red(`\u2715 ${msg}
|
|
37772
37905
|
`));
|
|
37773
37906
|
process.exit(2);
|
|
37774
37907
|
}
|
|
@@ -37776,7 +37909,7 @@ async function fundWallet(address, opts) {
|
|
|
37776
37909
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37777
37910
|
const resolved = await resolveProfile(requested);
|
|
37778
37911
|
if (!resolved) {
|
|
37779
|
-
process.stderr.write(
|
|
37912
|
+
process.stderr.write(import_picocolors17.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37780
37913
|
process.exit(2);
|
|
37781
37914
|
}
|
|
37782
37915
|
const { name: profileName, profile } = resolved;
|
|
@@ -37853,11 +37986,11 @@ async function fundWallet(address, opts) {
|
|
|
37853
37986
|
}
|
|
37854
37987
|
|
|
37855
37988
|
// src/commands/earn-supply.ts
|
|
37856
|
-
var
|
|
37989
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
37857
37990
|
var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37858
37991
|
var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37859
37992
|
function failArg4(msg) {
|
|
37860
|
-
process.stderr.write(
|
|
37993
|
+
process.stderr.write(import_picocolors18.default.red(`\u2715 ${msg}
|
|
37861
37994
|
`));
|
|
37862
37995
|
process.exit(2);
|
|
37863
37996
|
}
|
|
@@ -37865,11 +37998,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37865
37998
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37866
37999
|
const resolved = await resolveProfile(requested);
|
|
37867
38000
|
if (!resolved) {
|
|
37868
|
-
process.stderr.write(
|
|
38001
|
+
process.stderr.write(import_picocolors18.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37869
38002
|
process.exit(2);
|
|
37870
38003
|
}
|
|
37871
38004
|
if (resolved.autoSelected) {
|
|
37872
|
-
process.stderr.write(
|
|
38005
|
+
process.stderr.write(import_picocolors18.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37873
38006
|
`));
|
|
37874
38007
|
}
|
|
37875
38008
|
const { profile, name: profileName } = resolved;
|
|
@@ -37877,12 +38010,12 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37877
38010
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37878
38011
|
const amountNumber = Number(amount);
|
|
37879
38012
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37880
|
-
failArg4(`amount must be a positive number (got ${
|
|
38013
|
+
failArg4(`amount must be a positive number (got ${import_picocolors18.default.bold(amount)}).`);
|
|
37881
38014
|
}
|
|
37882
38015
|
const assetNorm = asset.toLowerCase();
|
|
37883
38016
|
if (!ASSET_VALUES2.has(assetNorm)) {
|
|
37884
38017
|
failArg4(
|
|
37885
|
-
`asset must be ${
|
|
38018
|
+
`asset must be ${import_picocolors18.default.bold("native")} or ${import_picocolors18.default.bold("usdc")} (got ${import_picocolors18.default.bold(asset)}).`
|
|
37886
38019
|
);
|
|
37887
38020
|
}
|
|
37888
38021
|
if (!opts.chain) {
|
|
@@ -37894,7 +38027,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37894
38027
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37895
38028
|
if (!PROTOCOLS.has(protocolNorm)) {
|
|
37896
38029
|
failArg4(
|
|
37897
|
-
`--protocol must be ${
|
|
38030
|
+
`--protocol must be ${import_picocolors18.default.bold("aave_v3")} or ${import_picocolors18.default.bold("kamino_lend")} (got ${import_picocolors18.default.bold(opts.protocol)}).`
|
|
37898
38031
|
);
|
|
37899
38032
|
}
|
|
37900
38033
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37946,11 +38079,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37946
38079
|
}
|
|
37947
38080
|
|
|
37948
38081
|
// src/commands/earn-withdraw.ts
|
|
37949
|
-
var
|
|
38082
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
37950
38083
|
var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37951
38084
|
var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37952
38085
|
function failArg5(msg) {
|
|
37953
|
-
process.stderr.write(
|
|
38086
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${msg}
|
|
37954
38087
|
`));
|
|
37955
38088
|
process.exit(2);
|
|
37956
38089
|
}
|
|
@@ -37958,11 +38091,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37958
38091
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37959
38092
|
const resolved = await resolveProfile(requested);
|
|
37960
38093
|
if (!resolved) {
|
|
37961
|
-
process.stderr.write(
|
|
38094
|
+
process.stderr.write(import_picocolors19.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37962
38095
|
process.exit(2);
|
|
37963
38096
|
}
|
|
37964
38097
|
if (resolved.autoSelected) {
|
|
37965
|
-
process.stderr.write(
|
|
38098
|
+
process.stderr.write(import_picocolors19.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37966
38099
|
`));
|
|
37967
38100
|
}
|
|
37968
38101
|
const { profile, name: profileName } = resolved;
|
|
@@ -37973,14 +38106,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37973
38106
|
const amountNumber = Number(amountOrMax);
|
|
37974
38107
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37975
38108
|
failArg5(
|
|
37976
|
-
`<amount-or-max> must be a positive number or the literal string "max" (got ${
|
|
38109
|
+
`<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors19.default.bold(amountOrMax)}).`
|
|
37977
38110
|
);
|
|
37978
38111
|
}
|
|
37979
38112
|
}
|
|
37980
38113
|
const assetNorm = asset.toLowerCase();
|
|
37981
38114
|
if (!ASSET_VALUES3.has(assetNorm)) {
|
|
37982
38115
|
failArg5(
|
|
37983
|
-
`asset must be ${
|
|
38116
|
+
`asset must be ${import_picocolors19.default.bold("native")} or ${import_picocolors19.default.bold("usdc")} (got ${import_picocolors19.default.bold(asset)}).`
|
|
37984
38117
|
);
|
|
37985
38118
|
}
|
|
37986
38119
|
if (!opts.chain) {
|
|
@@ -37992,7 +38125,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37992
38125
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37993
38126
|
if (!PROTOCOLS2.has(protocolNorm)) {
|
|
37994
38127
|
failArg5(
|
|
37995
|
-
`--protocol must be ${
|
|
38128
|
+
`--protocol must be ${import_picocolors19.default.bold("aave_v3")} or ${import_picocolors19.default.bold("kamino_lend")} (got ${import_picocolors19.default.bold(opts.protocol)}).`
|
|
37996
38129
|
);
|
|
37997
38130
|
}
|
|
37998
38131
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -38044,7 +38177,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
38044
38177
|
}
|
|
38045
38178
|
|
|
38046
38179
|
// src/commands/eat.ts
|
|
38047
|
-
var
|
|
38180
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
38048
38181
|
function parseLineJson(values) {
|
|
38049
38182
|
const lines = [];
|
|
38050
38183
|
for (const value of values) {
|
|
@@ -38071,11 +38204,11 @@ function parseLineJson(values) {
|
|
|
38071
38204
|
async function loadResolvedProfile(requested) {
|
|
38072
38205
|
const resolved = await resolveProfile(requested);
|
|
38073
38206
|
if (!resolved) {
|
|
38074
|
-
process.stderr.write(
|
|
38207
|
+
process.stderr.write(import_picocolors20.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38075
38208
|
process.exit(2);
|
|
38076
38209
|
}
|
|
38077
38210
|
if (resolved.autoSelected) {
|
|
38078
|
-
process.stderr.write(
|
|
38211
|
+
process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38079
38212
|
`));
|
|
38080
38213
|
}
|
|
38081
38214
|
return resolved;
|
|
@@ -38086,12 +38219,12 @@ function printResult(res, jsonMode) {
|
|
|
38086
38219
|
return;
|
|
38087
38220
|
}
|
|
38088
38221
|
if (res.blocked) {
|
|
38089
|
-
process.stderr.write(
|
|
38222
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
|
|
38090
38223
|
`));
|
|
38091
38224
|
if (res.upgrade_url) {
|
|
38092
38225
|
process.stderr.write(
|
|
38093
38226
|
` Open this to grant access, then re-run the command:
|
|
38094
|
-
${
|
|
38227
|
+
${import_picocolors20.default.cyan(res.upgrade_url)}
|
|
38095
38228
|
`
|
|
38096
38229
|
);
|
|
38097
38230
|
}
|
|
@@ -38122,7 +38255,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38122
38255
|
profile: resolved.profile,
|
|
38123
38256
|
profileName: resolved.name,
|
|
38124
38257
|
jsonMode,
|
|
38125
|
-
ttyHeader:
|
|
38258
|
+
ttyHeader: import_picocolors20.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38126
38259
|
fn: (bearer, origin) => apiFetch(path5, { method: "POST", bearer, origin, body })
|
|
38127
38260
|
});
|
|
38128
38261
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38132,7 +38265,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38132
38265
|
);
|
|
38133
38266
|
process.exit(1);
|
|
38134
38267
|
}
|
|
38135
|
-
process.stderr.write(
|
|
38268
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${outcome.reason}.
|
|
38136
38269
|
`));
|
|
38137
38270
|
process.exit(1);
|
|
38138
38271
|
}
|
|
@@ -38145,7 +38278,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38145
38278
|
);
|
|
38146
38279
|
process.exit(1);
|
|
38147
38280
|
}
|
|
38148
|
-
process.stderr.write(
|
|
38281
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38149
38282
|
`));
|
|
38150
38283
|
process.exit(1);
|
|
38151
38284
|
}
|
|
@@ -38158,7 +38291,7 @@ async function searchFood(opts) {
|
|
|
38158
38291
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38159
38292
|
if (!opts.location && !opts.name) {
|
|
38160
38293
|
process.stderr.write(
|
|
38161
|
-
|
|
38294
|
+
import_picocolors20.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
|
|
38162
38295
|
);
|
|
38163
38296
|
process.exit(2);
|
|
38164
38297
|
}
|
|
@@ -38179,7 +38312,7 @@ async function menuFood(items, opts) {
|
|
|
38179
38312
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38180
38313
|
if (!opts.brand || !opts.address) {
|
|
38181
38314
|
process.stderr.write(
|
|
38182
|
-
|
|
38315
|
+
import_picocolors20.default.red(
|
|
38183
38316
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38184
38317
|
)
|
|
38185
38318
|
);
|
|
@@ -38199,7 +38332,7 @@ async function orderFood(items, opts) {
|
|
|
38199
38332
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38200
38333
|
if (!opts.brand || !opts.address) {
|
|
38201
38334
|
process.stderr.write(
|
|
38202
|
-
|
|
38335
|
+
import_picocolors20.default.red(
|
|
38203
38336
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38204
38337
|
)
|
|
38205
38338
|
);
|
|
@@ -38209,14 +38342,14 @@ async function orderFood(items, opts) {
|
|
|
38209
38342
|
try {
|
|
38210
38343
|
structuredLines = parseLineJson(opts.lineJson ?? []);
|
|
38211
38344
|
} catch (e) {
|
|
38212
|
-
process.stderr.write(
|
|
38345
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
|
|
38213
38346
|
`));
|
|
38214
38347
|
process.exit(2);
|
|
38215
38348
|
}
|
|
38216
38349
|
const lines = [...items ?? [], ...structuredLines];
|
|
38217
38350
|
if (lines.length === 0) {
|
|
38218
38351
|
process.stderr.write(
|
|
38219
|
-
|
|
38352
|
+
import_picocolors20.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")
|
|
38220
38353
|
);
|
|
38221
38354
|
process.exit(2);
|
|
38222
38355
|
}
|
|
@@ -38250,7 +38383,7 @@ async function orderFood(items, opts) {
|
|
|
38250
38383
|
if (!agentCard.will_attempt) {
|
|
38251
38384
|
if (!jsonMode) {
|
|
38252
38385
|
process.stderr.write(
|
|
38253
|
-
|
|
38386
|
+
import_picocolors20.default.yellow(
|
|
38254
38387
|
`This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
|
|
38255
38388
|
`
|
|
38256
38389
|
)
|
|
@@ -38267,7 +38400,7 @@ async function orderFood(items, opts) {
|
|
|
38267
38400
|
}
|
|
38268
38401
|
if (verdict.status === "paid") {
|
|
38269
38402
|
process.stdout.write(
|
|
38270
|
-
|
|
38403
|
+
import_picocolors20.default.green(
|
|
38271
38404
|
`Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
|
|
38272
38405
|
)
|
|
38273
38406
|
);
|
|
@@ -38275,7 +38408,7 @@ async function orderFood(items, opts) {
|
|
|
38275
38408
|
}
|
|
38276
38409
|
if (verdict.status === "failed") {
|
|
38277
38410
|
process.stderr.write(
|
|
38278
|
-
|
|
38411
|
+
import_picocolors20.default.yellow(
|
|
38279
38412
|
`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.
|
|
38280
38413
|
`
|
|
38281
38414
|
)
|
|
@@ -38285,7 +38418,7 @@ async function orderFood(items, opts) {
|
|
|
38285
38418
|
}
|
|
38286
38419
|
if (verdict.status === "unconfirmed") {
|
|
38287
38420
|
process.stderr.write(
|
|
38288
|
-
|
|
38421
|
+
import_picocolors20.default.red(
|
|
38289
38422
|
"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}
|
|
38290
38423
|
` : "")
|
|
38291
38424
|
)
|
|
@@ -38294,7 +38427,7 @@ async function orderFood(items, opts) {
|
|
|
38294
38427
|
return;
|
|
38295
38428
|
}
|
|
38296
38429
|
process.stderr.write(
|
|
38297
|
-
|
|
38430
|
+
import_picocolors20.default.dim(
|
|
38298
38431
|
`Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
|
|
38299
38432
|
)
|
|
38300
38433
|
);
|
|
@@ -38319,7 +38452,7 @@ var POLL_BUDGET_MS = 1e5;
|
|
|
38319
38452
|
var POLL_INTERVAL_MS2 = 3500;
|
|
38320
38453
|
async function pollOrderVerdict(orderId, resolved, jsonMode) {
|
|
38321
38454
|
if (!jsonMode) {
|
|
38322
|
-
process.stderr.write(
|
|
38455
|
+
process.stderr.write(import_picocolors20.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
|
|
38323
38456
|
}
|
|
38324
38457
|
const deadline = Date.now() + POLL_BUDGET_MS;
|
|
38325
38458
|
let last = {
|
|
@@ -38389,16 +38522,16 @@ async function statusFood(orderId, opts) {
|
|
|
38389
38522
|
}
|
|
38390
38523
|
|
|
38391
38524
|
// src/commands/bounties.ts
|
|
38392
|
-
var
|
|
38525
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
38393
38526
|
async function withProfile(opts, path5, init) {
|
|
38394
38527
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38395
38528
|
const resolved = await resolveProfile(requested);
|
|
38396
38529
|
if (!resolved) {
|
|
38397
|
-
process.stderr.write(
|
|
38530
|
+
process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38398
38531
|
process.exit(2);
|
|
38399
38532
|
}
|
|
38400
38533
|
if (resolved.autoSelected) {
|
|
38401
|
-
process.stderr.write(
|
|
38534
|
+
process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38402
38535
|
`));
|
|
38403
38536
|
}
|
|
38404
38537
|
const { profile, name: profileName } = resolved;
|
|
@@ -38407,7 +38540,7 @@ async function withProfile(opts, path5, init) {
|
|
|
38407
38540
|
profile,
|
|
38408
38541
|
profileName,
|
|
38409
38542
|
jsonMode,
|
|
38410
|
-
ttyHeader:
|
|
38543
|
+
ttyHeader: import_picocolors21.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38411
38544
|
fn: (bearer, origin) => apiFetch(path5, init ? { bearer, origin, method: init.method, body: init.body } : { bearer, origin })
|
|
38412
38545
|
});
|
|
38413
38546
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38415,14 +38548,14 @@ async function withProfile(opts, path5, init) {
|
|
|
38415
38548
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38416
38549
|
process.exit(1);
|
|
38417
38550
|
}
|
|
38418
|
-
process.stderr.write(
|
|
38551
|
+
process.stderr.write(import_picocolors21.default.red(`\u2715 ${outcome.reason}.
|
|
38419
38552
|
`));
|
|
38420
38553
|
process.exit(1);
|
|
38421
38554
|
}
|
|
38422
38555
|
if (outcome.kind === "error") {
|
|
38423
38556
|
const err = outcome.error;
|
|
38424
38557
|
if (err instanceof ApiError) {
|
|
38425
|
-
process.stderr.write(
|
|
38558
|
+
process.stderr.write(import_picocolors21.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38426
38559
|
`));
|
|
38427
38560
|
process.exit(1);
|
|
38428
38561
|
}
|
|
@@ -38436,12 +38569,12 @@ function handleBlocked(res, jsonMode) {
|
|
|
38436
38569
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38437
38570
|
process.exit(1);
|
|
38438
38571
|
}
|
|
38439
|
-
process.stderr.write(
|
|
38572
|
+
process.stderr.write(import_picocolors21.default.yellow(`
|
|
38440
38573
|
${res.reason ?? "Blocked."}
|
|
38441
38574
|
`));
|
|
38442
38575
|
if (res.upgrade_url) {
|
|
38443
38576
|
process.stderr.write(`
|
|
38444
|
-
${
|
|
38577
|
+
${import_picocolors21.default.bold(res.upgrade_url)}
|
|
38445
38578
|
|
|
38446
38579
|
`);
|
|
38447
38580
|
}
|
|
@@ -38484,14 +38617,14 @@ function printTable(rows) {
|
|
|
38484
38617
|
const cLeft = w("left", 4);
|
|
38485
38618
|
const cSubs = w("subs", 4);
|
|
38486
38619
|
process.stdout.write(
|
|
38487
|
-
|
|
38620
|
+
import_picocolors21.default.dim(
|
|
38488
38621
|
"Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
|
|
38489
38622
|
) + "\n"
|
|
38490
38623
|
);
|
|
38491
38624
|
for (const c of cells) {
|
|
38492
|
-
const title = c.live ?
|
|
38625
|
+
const title = c.live ? import_picocolors21.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
|
|
38493
38626
|
process.stdout.write(
|
|
38494
|
-
|
|
38627
|
+
import_picocolors21.default.bold(c.amount.padStart(cAmount)) + " " + title + " " + c.chain.padEnd(cChain) + " " + c.ev.padEnd(cEv) + " " + c.left.padStart(cLeft) + " " + c.subs.padStart(cSubs) + " " + import_picocolors21.default.dim(c.id) + "\n"
|
|
38495
38628
|
);
|
|
38496
38629
|
}
|
|
38497
38630
|
}
|
|
@@ -38503,11 +38636,11 @@ async function listBounties(opts) {
|
|
|
38503
38636
|
const min = opts.min !== void 0 ? Number(opts.min) : void 0;
|
|
38504
38637
|
const max = opts.max !== void 0 ? Number(opts.max) : void 0;
|
|
38505
38638
|
if (min !== void 0 && !Number.isFinite(min)) {
|
|
38506
|
-
process.stderr.write(
|
|
38639
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --min must be a number.\n"));
|
|
38507
38640
|
process.exit(2);
|
|
38508
38641
|
}
|
|
38509
38642
|
if (max !== void 0 && !Number.isFinite(max)) {
|
|
38510
|
-
process.stderr.write(
|
|
38643
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --max must be a number.\n"));
|
|
38511
38644
|
process.exit(2);
|
|
38512
38645
|
}
|
|
38513
38646
|
rows = rows.filter((r) => {
|
|
@@ -38532,7 +38665,7 @@ async function listBounties(opts) {
|
|
|
38532
38665
|
});
|
|
38533
38666
|
const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
|
|
38534
38667
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
38535
|
-
process.stderr.write(
|
|
38668
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --limit must be a positive number.\n"));
|
|
38536
38669
|
process.exit(2);
|
|
38537
38670
|
}
|
|
38538
38671
|
const shown = rows.slice(0, limit);
|
|
@@ -38541,13 +38674,13 @@ async function listBounties(opts) {
|
|
|
38541
38674
|
return;
|
|
38542
38675
|
}
|
|
38543
38676
|
if (shown.length === 0) {
|
|
38544
|
-
process.stdout.write(
|
|
38677
|
+
process.stdout.write(import_picocolors21.default.dim("No active bounties match.\n"));
|
|
38545
38678
|
return;
|
|
38546
38679
|
}
|
|
38547
38680
|
printTable(shown);
|
|
38548
38681
|
const clipped = rows.length - shown.length;
|
|
38549
38682
|
process.stdout.write(
|
|
38550
|
-
"\n" +
|
|
38683
|
+
"\n" + import_picocolors21.default.dim(
|
|
38551
38684
|
`${shown.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
|
|
38552
38685
|
`
|
|
38553
38686
|
)
|
|
@@ -38558,7 +38691,7 @@ async function showBounty(id, opts) {
|
|
|
38558
38691
|
const jsonMode = opts.json === true;
|
|
38559
38692
|
const clean = id.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
|
|
38560
38693
|
if (!clean) {
|
|
38561
|
-
process.stderr.write(
|
|
38694
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
|
|
38562
38695
|
process.exit(2);
|
|
38563
38696
|
}
|
|
38564
38697
|
const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean)}`);
|
|
@@ -38569,26 +38702,26 @@ async function showBounty(id, opts) {
|
|
|
38569
38702
|
}
|
|
38570
38703
|
const b = res.bounty;
|
|
38571
38704
|
if (!b) {
|
|
38572
|
-
process.stdout.write(
|
|
38705
|
+
process.stdout.write(import_picocolors21.default.dim("Not found.\n"));
|
|
38573
38706
|
return;
|
|
38574
38707
|
}
|
|
38575
|
-
process.stdout.write("\n" +
|
|
38708
|
+
process.stdout.write("\n" + import_picocolors21.default.bold(b.title) + "\n\n");
|
|
38576
38709
|
process.stdout.write(b.description + "\n\n");
|
|
38577
38710
|
process.stdout.write(
|
|
38578
|
-
|
|
38711
|
+
import_picocolors21.default.bold(fmtAmount(b.amount)) + import_picocolors21.default.dim(" USDC") + import_picocolors21.default.dim(` \xB7 ${chainOf2(b)} \xB7 ${b.status.toLowerCase()}`) + (b.liveNow ? import_picocolors21.default.green(" \xB7 LIVE now") : "") + "\n"
|
|
38579
38712
|
);
|
|
38580
38713
|
if (b.claimsAllowed && b.claimsAllowed > 1) {
|
|
38581
38714
|
const left = Math.max(0, b.claimsAllowed - (b.claimsPaid ?? 0));
|
|
38582
38715
|
process.stdout.write(
|
|
38583
|
-
|
|
38716
|
+
import_picocolors21.default.dim(
|
|
38584
38717
|
`${left} of ${b.claimsAllowed} claims left` + (b.perClaimAmount != null ? `, ${fmtAmount(b.perClaimAmount)} each` : "")
|
|
38585
38718
|
) + "\n"
|
|
38586
38719
|
);
|
|
38587
38720
|
}
|
|
38588
|
-
if (b.evidenceType) process.stdout.write(
|
|
38589
|
-
if (b.expiresAt) process.stdout.write(
|
|
38721
|
+
if (b.evidenceType) process.stdout.write(import_picocolors21.default.dim(`Evidence required: ${b.evidenceType}`) + "\n");
|
|
38722
|
+
if (b.expiresAt) process.stdout.write(import_picocolors21.default.dim(`Expires in ${fmtExpiry(b.expiresAt)}`) + "\n");
|
|
38590
38723
|
if (b.geoLabel && b.geoScope !== "global") {
|
|
38591
|
-
process.stdout.write(
|
|
38724
|
+
process.stdout.write(import_picocolors21.default.dim(`Creator says: ${b.geoLabel}`) + "\n");
|
|
38592
38725
|
}
|
|
38593
38726
|
if (res.url) process.stdout.write("\n" + res.url + "\n");
|
|
38594
38727
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38606,7 +38739,7 @@ async function myBounties(opts) {
|
|
|
38606
38739
|
}
|
|
38607
38740
|
if (rows.length === 0) {
|
|
38608
38741
|
process.stdout.write(
|
|
38609
|
-
|
|
38742
|
+
import_picocolors21.default.dim(
|
|
38610
38743
|
status2 ? `No bounties of yours are ${status2}.
|
|
38611
38744
|
` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
|
|
38612
38745
|
)
|
|
@@ -38616,7 +38749,7 @@ async function myBounties(opts) {
|
|
|
38616
38749
|
printTable(rows);
|
|
38617
38750
|
const subs = res.submissions ?? [];
|
|
38618
38751
|
if (subs.length > 0) {
|
|
38619
|
-
process.stdout.write("\n" +
|
|
38752
|
+
process.stdout.write("\n" + import_picocolors21.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
|
|
38620
38753
|
`));
|
|
38621
38754
|
}
|
|
38622
38755
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38635,19 +38768,19 @@ async function bountyFeed(opts) {
|
|
|
38635
38768
|
}
|
|
38636
38769
|
const subs = res.submissions ?? [];
|
|
38637
38770
|
if (subs.length === 0) {
|
|
38638
|
-
process.stdout.write(
|
|
38771
|
+
process.stdout.write(import_picocolors21.default.dim("Nothing in the feed for that filter.\n"));
|
|
38639
38772
|
return;
|
|
38640
38773
|
}
|
|
38641
38774
|
process.stdout.write(
|
|
38642
|
-
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ?
|
|
38775
|
+
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors21.default.dim(" More available.") : "") + "\n"
|
|
38643
38776
|
);
|
|
38644
|
-
process.stdout.write(
|
|
38777
|
+
process.stdout.write(import_picocolors21.default.dim("Use --json for the full rows.\n"));
|
|
38645
38778
|
}
|
|
38646
38779
|
async function draftBounty(opts) {
|
|
38647
38780
|
const jsonMode = opts.json === true;
|
|
38648
38781
|
const amountNum = Number(opts.amount);
|
|
38649
38782
|
if (!Number.isFinite(amountNum) || amountNum <= 0) {
|
|
38650
|
-
process.stderr.write(
|
|
38783
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --amount must be a positive number of USDC.\n"));
|
|
38651
38784
|
process.exit(2);
|
|
38652
38785
|
}
|
|
38653
38786
|
const res = await withProfile(opts, "/api/bounties", {
|
|
@@ -38665,20 +38798,20 @@ async function draftBounty(opts) {
|
|
|
38665
38798
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38666
38799
|
return;
|
|
38667
38800
|
}
|
|
38668
|
-
process.stdout.write("\n" +
|
|
38801
|
+
process.stdout.write("\n" + import_picocolors21.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
|
|
38669
38802
|
|
|
38670
38803
|
`);
|
|
38671
|
-
process.stdout.write(
|
|
38804
|
+
process.stdout.write(import_picocolors21.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
|
|
38672
38805
|
if (res.fund_url) {
|
|
38673
|
-
process.stdout.write("\nFund it here:\n" +
|
|
38674
|
-
process.stdout.write(
|
|
38806
|
+
process.stdout.write("\nFund it here:\n" + import_picocolors21.default.bold(res.fund_url) + "\n\n");
|
|
38807
|
+
process.stdout.write(import_picocolors21.default.dim("Funding happens in your browser with your own wallet.\n"));
|
|
38675
38808
|
}
|
|
38676
38809
|
}
|
|
38677
38810
|
|
|
38678
38811
|
// src/commands/bounty-money.ts
|
|
38679
|
-
var
|
|
38812
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
38680
38813
|
function failArg6(message) {
|
|
38681
|
-
process.stderr.write(
|
|
38814
|
+
process.stderr.write(import_picocolors22.default.red(`${message}
|
|
38682
38815
|
`));
|
|
38683
38816
|
process.exit(2);
|
|
38684
38817
|
}
|
|
@@ -38690,12 +38823,12 @@ async function loadProfileOrExit(requested, jsonMode) {
|
|
|
38690
38823
|
JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
|
|
38691
38824
|
);
|
|
38692
38825
|
} else {
|
|
38693
|
-
process.stderr.write(
|
|
38826
|
+
process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38694
38827
|
}
|
|
38695
38828
|
process.exit(2);
|
|
38696
38829
|
}
|
|
38697
38830
|
if (resolved.autoSelected && !jsonMode) {
|
|
38698
|
-
process.stderr.write(
|
|
38831
|
+
process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38699
38832
|
`));
|
|
38700
38833
|
}
|
|
38701
38834
|
return { profile: resolved.profile, profileName: resolved.name };
|
|
@@ -38800,16 +38933,16 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
38800
38933
|
}
|
|
38801
38934
|
|
|
38802
38935
|
// src/commands/bounty-work.ts
|
|
38803
|
-
var
|
|
38936
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
38804
38937
|
async function runWork(path5, body, opts) {
|
|
38805
38938
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38806
38939
|
const resolved = await resolveProfile(requested);
|
|
38807
38940
|
if (!resolved) {
|
|
38808
|
-
process.stderr.write(
|
|
38941
|
+
process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38809
38942
|
process.exit(2);
|
|
38810
38943
|
}
|
|
38811
38944
|
if (resolved.autoSelected) {
|
|
38812
|
-
process.stderr.write(
|
|
38945
|
+
process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38813
38946
|
`));
|
|
38814
38947
|
}
|
|
38815
38948
|
const jsonMode = opts.json === true;
|
|
@@ -38817,7 +38950,7 @@ async function runWork(path5, body, opts) {
|
|
|
38817
38950
|
profile: resolved.profile,
|
|
38818
38951
|
profileName: resolved.name,
|
|
38819
38952
|
jsonMode,
|
|
38820
|
-
ttyHeader:
|
|
38953
|
+
ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38821
38954
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38822
38955
|
});
|
|
38823
38956
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38825,7 +38958,7 @@ async function runWork(path5, body, opts) {
|
|
|
38825
38958
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38826
38959
|
process.exit(1);
|
|
38827
38960
|
}
|
|
38828
|
-
process.stderr.write(
|
|
38961
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${outcome.reason}.
|
|
38829
38962
|
`));
|
|
38830
38963
|
process.exit(1);
|
|
38831
38964
|
}
|
|
@@ -38835,7 +38968,7 @@ async function runWork(path5, body, opts) {
|
|
|
38835
38968
|
if (jsonMode) {
|
|
38836
38969
|
process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
|
|
38837
38970
|
} else {
|
|
38838
|
-
process.stderr.write(
|
|
38971
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38839
38972
|
`));
|
|
38840
38973
|
}
|
|
38841
38974
|
process.exit(1);
|
|
@@ -38848,11 +38981,11 @@ async function runWork(path5, body, opts) {
|
|
|
38848
38981
|
process.stdout.write(JSON.stringify({ ok: false, ...data }) + "\n");
|
|
38849
38982
|
process.exit(1);
|
|
38850
38983
|
}
|
|
38851
|
-
process.stderr.write(
|
|
38984
|
+
process.stderr.write(import_picocolors23.default.yellow(`
|
|
38852
38985
|
${data.reason ?? "Blocked."}
|
|
38853
38986
|
`));
|
|
38854
38987
|
if (data.upgrade_url) process.stderr.write(`
|
|
38855
|
-
${
|
|
38988
|
+
${import_picocolors23.default.bold(data.upgrade_url)}
|
|
38856
38989
|
|
|
38857
38990
|
`);
|
|
38858
38991
|
process.exit(1);
|
|
@@ -38861,7 +38994,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38861
38994
|
if (jsonMode) {
|
|
38862
38995
|
process.stdout.write(JSON.stringify({ ok: false, error: data.error }) + "\n");
|
|
38863
38996
|
} else {
|
|
38864
|
-
process.stderr.write(
|
|
38997
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${data.error}
|
|
38865
38998
|
`));
|
|
38866
38999
|
}
|
|
38867
39000
|
process.exit(1);
|
|
@@ -38904,7 +39037,7 @@ async function bountyRetention(bountyId, opts) {
|
|
|
38904
39037
|
}
|
|
38905
39038
|
|
|
38906
39039
|
// src/commands/bounty-deliver.ts
|
|
38907
|
-
var
|
|
39040
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
38908
39041
|
import { spawn } from "node:child_process";
|
|
38909
39042
|
var FLUSH_MS = 400;
|
|
38910
39043
|
var FLUSH_BYTES = 2048;
|
|
@@ -38913,11 +39046,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38913
39046
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38914
39047
|
const resolved = await resolveProfile(requested);
|
|
38915
39048
|
if (!resolved) {
|
|
38916
|
-
process.stderr.write(
|
|
39049
|
+
process.stderr.write(import_picocolors24.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38917
39050
|
process.exit(2);
|
|
38918
39051
|
}
|
|
38919
39052
|
if (resolved.autoSelected && !jsonMode) {
|
|
38920
|
-
process.stderr.write(
|
|
39053
|
+
process.stderr.write(import_picocolors24.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38921
39054
|
`));
|
|
38922
39055
|
}
|
|
38923
39056
|
const post = async (path5, body) => {
|
|
@@ -38925,7 +39058,7 @@ async function deliver(bountyId, command, opts) {
|
|
|
38925
39058
|
profile: resolved.profile,
|
|
38926
39059
|
profileName: resolved.name,
|
|
38927
39060
|
jsonMode,
|
|
38928
|
-
ttyHeader:
|
|
39061
|
+
ttyHeader: import_picocolors24.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38929
39062
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38930
39063
|
});
|
|
38931
39064
|
if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
|
|
@@ -38936,11 +39069,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38936
39069
|
if (jsonMode) {
|
|
38937
39070
|
process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data ?? {} }) + "\n");
|
|
38938
39071
|
} else {
|
|
38939
|
-
process.stderr.write(
|
|
39072
|
+
process.stderr.write(import_picocolors24.default.red(`
|
|
38940
39073
|
\u2715 ${msg}
|
|
38941
39074
|
`));
|
|
38942
39075
|
if (data?.upgrade_url) process.stderr.write(`
|
|
38943
|
-
${
|
|
39076
|
+
${import_picocolors24.default.bold(data.upgrade_url)}
|
|
38944
39077
|
|
|
38945
39078
|
`);
|
|
38946
39079
|
}
|
|
@@ -38965,7 +39098,7 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
38965
39098
|
if (!runId) return void die("The service opened a run but did not name it.");
|
|
38966
39099
|
if (!jsonMode) {
|
|
38967
39100
|
process.stderr.write(
|
|
38968
|
-
|
|
39101
|
+
import_picocolors24.default.bold("\n\u25CF LIVE ") + import_picocolors24.default.dim("everything below is going onto the bounty page as it happens\n") + import_picocolors24.default.dim(` ${started.url ?? ""}
|
|
38969
39102
|
|
|
38970
39103
|
`)
|
|
38971
39104
|
);
|
|
@@ -39017,10 +39150,10 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39017
39150
|
child.stdout.on("data", (d) => consume(d));
|
|
39018
39151
|
child.stderr.setEncoding("utf8");
|
|
39019
39152
|
child.stderr.on("data", (d) => {
|
|
39020
|
-
if (!jsonMode) process.stderr.write(
|
|
39153
|
+
if (!jsonMode) process.stderr.write(import_picocolors24.default.dim(d));
|
|
39021
39154
|
});
|
|
39022
39155
|
child.on("error", (err) => {
|
|
39023
|
-
process.stderr.write(
|
|
39156
|
+
process.stderr.write(import_picocolors24.default.red(`
|
|
39024
39157
|
\u2715 Could not run ${command[0]}: ${err.message}
|
|
39025
39158
|
`));
|
|
39026
39159
|
resolve(127);
|
|
@@ -39057,14 +39190,14 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39057
39190
|
}
|
|
39058
39191
|
if (appendFailure) {
|
|
39059
39192
|
process.stderr.write(
|
|
39060
|
-
|
|
39193
|
+
import_picocolors24.default.yellow(`
|
|
39061
39194
|
! Some output did not reach the page: ${appendFailure}
|
|
39062
|
-
`) +
|
|
39195
|
+
`) + import_picocolors24.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
|
|
39063
39196
|
);
|
|
39064
39197
|
}
|
|
39065
39198
|
if (exitCode) {
|
|
39066
39199
|
process.stderr.write(
|
|
39067
|
-
|
|
39200
|
+
import_picocolors24.default.yellow(`
|
|
39068
39201
|
! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
|
|
39069
39202
|
`)
|
|
39070
39203
|
);
|
|
@@ -39074,7 +39207,7 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39074
39207
|
}
|
|
39075
39208
|
|
|
39076
39209
|
// src/commands/trade.ts
|
|
39077
|
-
var
|
|
39210
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
39078
39211
|
|
|
39079
39212
|
// src/lib/trade-sol.ts
|
|
39080
39213
|
var import_web3 = __toESM(require_index_cjs(), 1);
|
|
@@ -39440,7 +39573,7 @@ function fail(message, json) {
|
|
|
39440
39573
|
if (json) {
|
|
39441
39574
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39442
39575
|
} else {
|
|
39443
|
-
process.stderr.write(
|
|
39576
|
+
process.stderr.write(import_picocolors25.default.red(`\u2715 ${message}
|
|
39444
39577
|
`));
|
|
39445
39578
|
}
|
|
39446
39579
|
process.exit(1);
|
|
@@ -39631,7 +39764,7 @@ async function tradeBuy(coinArg, amount, opts) {
|
|
|
39631
39764
|
}
|
|
39632
39765
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39633
39766
|
if (created && !opts.json) {
|
|
39634
|
-
process.stderr.write(
|
|
39767
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39635
39768
|
`));
|
|
39636
39769
|
}
|
|
39637
39770
|
const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
|
|
@@ -39685,7 +39818,7 @@ async function tradeOrderPlace(coinArg, opts) {
|
|
|
39685
39818
|
if (opts.mcap && !opts.at) fail("--mcap qualifies --at.", opts.json);
|
|
39686
39819
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39687
39820
|
if (created && !opts.json) {
|
|
39688
|
-
process.stderr.write(
|
|
39821
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39689
39822
|
`));
|
|
39690
39823
|
}
|
|
39691
39824
|
let amount;
|
|
@@ -39850,7 +39983,7 @@ async function tradePositions(opts) {
|
|
|
39850
39983
|
}
|
|
39851
39984
|
|
|
39852
39985
|
// src/commands/desk.ts
|
|
39853
|
-
var
|
|
39986
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
39854
39987
|
|
|
39855
39988
|
// src/lib/desk-sol.ts
|
|
39856
39989
|
var import_web32 = __toESM(require_index_cjs(), 1);
|
|
@@ -40024,7 +40157,7 @@ function fail2(message, json) {
|
|
|
40024
40157
|
if (json) {
|
|
40025
40158
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
40026
40159
|
} else {
|
|
40027
|
-
process.stderr.write(
|
|
40160
|
+
process.stderr.write(import_picocolors26.default.red(`\u2715 ${message}
|
|
40028
40161
|
`));
|
|
40029
40162
|
}
|
|
40030
40163
|
process.exit(1);
|
|
@@ -40167,7 +40300,7 @@ async function deskDeposit(amount, opts) {
|
|
|
40167
40300
|
if (units <= 0n) fail2("Deposit amount must be above zero.", opts.json);
|
|
40168
40301
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
40169
40302
|
if (created && !opts.json) {
|
|
40170
|
-
process.stderr.write(
|
|
40303
|
+
process.stderr.write(import_picocolors26.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
40171
40304
|
`));
|
|
40172
40305
|
}
|
|
40173
40306
|
const result = await runDeskCeremony({
|
|
@@ -40262,13 +40395,13 @@ async function deskSessionRegister(opts) {
|
|
|
40262
40395
|
}
|
|
40263
40396
|
const owner = await loadOrCreateTradeKey();
|
|
40264
40397
|
if (owner.created && !opts.json) {
|
|
40265
|
-
process.stderr.write(
|
|
40398
|
+
process.stderr.write(import_picocolors26.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
|
|
40266
40399
|
`));
|
|
40267
40400
|
}
|
|
40268
40401
|
const session = await loadOrCreateDeskSessionKey();
|
|
40269
40402
|
if (session.created && !opts.json) {
|
|
40270
40403
|
process.stderr.write(
|
|
40271
|
-
|
|
40404
|
+
import_picocolors26.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
|
|
40272
40405
|
`)
|
|
40273
40406
|
);
|
|
40274
40407
|
}
|
|
@@ -40810,7 +40943,7 @@ program2.command("fund").description(
|
|
|
40810
40943
|
}
|
|
40811
40944
|
if (opts.usdc || opts.gas || opts.chain) {
|
|
40812
40945
|
process.stderr.write(
|
|
40813
|
-
|
|
40946
|
+
import_picocolors27.default.red(
|
|
40814
40947
|
`\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
|
|
40815
40948
|
`
|
|
40816
40949
|
)
|
|
@@ -40929,7 +41062,7 @@ desk.command("buy").description("Buy a launch coin with desk USDC credit (sessio
|
|
|
40929
41062
|
desk.command("sell").description("Sell desk coin credit back to the curve (session signs; sells uncapped by design \u2014 proceeds only ever land in the owner's vault)").argument("<coin>", "coin ticker or base58 mint address").argument("<amount>", 'coin amount, a percentage like "50%" (resolved from the state read), or "all"').option("--min-out <usdc>", "explicit min-out in USDC (overrides the server-owned guard)").option("--json", "machine-readable output").action(async (coin, amount, opts) => {
|
|
40930
41063
|
await deskSell(coin, amount, opts);
|
|
40931
41064
|
});
|
|
40932
|
-
program2.command("onboard").description("Welcome screen: look at what is for sale, or pair your wallet. Run by the installer.").option("--profile <name>", "named profile (default: 'default')").option("--lane <lane>", "which lane leads the menu: compute | inference | phone").action(async (opts) => {
|
|
41065
|
+
program2.command("onboard").description("Welcome screen: look at what is for sale, or pair your wallet. Run by the installer.").option("--profile <name>", "named profile (default: 'default')").option("--lane <lane>", "which lane leads the menu: compute | inference | phone | email").action(async (opts) => {
|
|
40933
41066
|
await onboard(opts);
|
|
40934
41067
|
});
|
|
40935
41068
|
var compute = program2.command("compute").description("Confidential virtual machines by the hour, USDC per payment");
|
|
@@ -40953,11 +41086,21 @@ phone.command("pricing").description("Number plans, per-unit usage and the payph
|
|
|
40953
41086
|
phone.command("call").description("Place a payphone call (needs an x402 signature this CLI does not have yet)").action(async () => {
|
|
40954
41087
|
await phoneCall();
|
|
40955
41088
|
});
|
|
41089
|
+
var email = program2.command("email").description("Inboxes on your wallet: free to hold on a funded balance, receiving free, sends per message, USDC over x402");
|
|
41090
|
+
email.command("pricing").description("The free inbox, the plans, the per-send price and the top-up floor. Public read: no key, no account, no payment.").option("--json", "machine-readable output (the email slice of the identity catalog)").action(async (opts) => {
|
|
41091
|
+
await emailPricing(opts);
|
|
41092
|
+
});
|
|
41093
|
+
email.command("create").description("Create an inbox (needs the wallet's signature this CLI does not have yet)").action(async () => {
|
|
41094
|
+
await emailCreate();
|
|
41095
|
+
});
|
|
41096
|
+
email.command("send").description("Send from an inbox (needs the wallet's signature this CLI does not have yet)").action(async () => {
|
|
41097
|
+
await emailSend();
|
|
41098
|
+
});
|
|
40956
41099
|
program2.parseAsync(process.argv).catch((err) => {
|
|
40957
|
-
process.stderr.write(
|
|
41100
|
+
process.stderr.write(import_picocolors27.default.red(`\u2715 ${err.message}
|
|
40958
41101
|
`));
|
|
40959
41102
|
if (process.env.BOUNTY_DEBUG) {
|
|
40960
|
-
process.stderr.write(
|
|
41103
|
+
process.stderr.write(import_picocolors27.default.dim((err.stack ?? "") + "\n"));
|
|
40961
41104
|
}
|
|
40962
41105
|
process.exit(1);
|
|
40963
41106
|
});
|