@agentgates/cli 0.12.0 → 0.13.1
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 +410 -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.1",
|
|
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/phone" },
|
|
35887
|
+
email: { key: "email", name: "email", docs: "/api/identity/docs/email" }
|
|
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,27 @@ 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/phone ${import_picocolors7.default.dim("\xB7 the phone contract: numbers, texts, calls, the payphone")}
|
|
35959
|
+
`);
|
|
35960
|
+
put(` ${CREATORS_ORIGIN}/api/identity/docs/email ${import_picocolors7.default.dim("\xB7 the email contract: inboxes, plans, sends, wait-code")}
|
|
35961
|
+
`);
|
|
35962
|
+
put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors7.default.dim("\xB7 the whole surface")}
|
|
35839
35963
|
|
|
35840
35964
|
`);
|
|
35841
35965
|
if (!existing) {
|
|
35842
|
-
put(` Pairing a wallet needs a human at a browser: ${
|
|
35966
|
+
put(` Pairing a wallet needs a human at a browser: ${import_picocolors7.default.bold("agentgates onboard")} in a real terminal.
|
|
35843
35967
|
|
|
35844
35968
|
`);
|
|
35845
35969
|
}
|
|
@@ -35860,7 +35984,7 @@ async function onboard(opts = {}) {
|
|
|
35860
35984
|
const fallback = first ? "1" : exitDefault;
|
|
35861
35985
|
let choice;
|
|
35862
35986
|
try {
|
|
35863
|
-
choice = (await rl.question(` ${
|
|
35987
|
+
choice = (await rl.question(` ${import_picocolors7.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
|
|
35864
35988
|
} catch {
|
|
35865
35989
|
if (first) w?.stop();
|
|
35866
35990
|
process.stdout.write("\n");
|
|
@@ -35884,7 +36008,7 @@ async function onboard(opts = {}) {
|
|
|
35884
36008
|
await runLoginFlow({ profile: profileName, jsonMode: false, ttyHeader: "Pairing this terminal with your wallet\u2026" });
|
|
35885
36009
|
process.stdout.write("\n");
|
|
35886
36010
|
} catch {
|
|
35887
|
-
plain(` ${
|
|
36011
|
+
plain(` ${import_picocolors7.default.red("\u2715")} pairing didn't complete
|
|
35888
36012
|
|
|
35889
36013
|
`);
|
|
35890
36014
|
}
|
|
@@ -35893,7 +36017,7 @@ async function onboard(opts = {}) {
|
|
|
35893
36017
|
try {
|
|
35894
36018
|
await computePlans({});
|
|
35895
36019
|
} catch {
|
|
35896
|
-
plain(` ${
|
|
36020
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the compute catalog
|
|
35897
36021
|
|
|
35898
36022
|
`);
|
|
35899
36023
|
}
|
|
@@ -35902,7 +36026,7 @@ async function onboard(opts = {}) {
|
|
|
35902
36026
|
try {
|
|
35903
36027
|
await inferenceModels({});
|
|
35904
36028
|
} catch {
|
|
35905
|
-
plain(` ${
|
|
36029
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the model catalog
|
|
35906
36030
|
|
|
35907
36031
|
`);
|
|
35908
36032
|
}
|
|
@@ -35911,7 +36035,16 @@ async function onboard(opts = {}) {
|
|
|
35911
36035
|
try {
|
|
35912
36036
|
await phonePricing({});
|
|
35913
36037
|
} catch {
|
|
35914
|
-
plain(` ${
|
|
36038
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the phone catalog
|
|
36039
|
+
|
|
36040
|
+
`);
|
|
36041
|
+
}
|
|
36042
|
+
break;
|
|
36043
|
+
case "email":
|
|
36044
|
+
try {
|
|
36045
|
+
await emailPricing({});
|
|
36046
|
+
} catch {
|
|
36047
|
+
plain(` ${import_picocolors7.default.red("\u2715")} could not read the email catalog
|
|
35915
36048
|
|
|
35916
36049
|
`);
|
|
35917
36050
|
}
|
|
@@ -35927,28 +36060,30 @@ async function onboard(opts = {}) {
|
|
|
35927
36060
|
}
|
|
35928
36061
|
}
|
|
35929
36062
|
function printNext(put) {
|
|
35930
|
-
put(` ${
|
|
36063
|
+
put(` ${import_picocolors7.default.dim("agentgates compute plans")} ${import_picocolors7.default.dim("\xB7 virtual machines by the hour")}
|
|
36064
|
+
`);
|
|
36065
|
+
put(` ${import_picocolors7.default.dim("agentgates inference models")} ${import_picocolors7.default.dim("\xB7 models by the token")}
|
|
35931
36066
|
`);
|
|
35932
|
-
put(` ${
|
|
36067
|
+
put(` ${import_picocolors7.default.dim("agentgates phone pricing")} ${import_picocolors7.default.dim("\xB7 numbers by the month, calls by the minute")}
|
|
35933
36068
|
`);
|
|
35934
|
-
put(` ${
|
|
36069
|
+
put(` ${import_picocolors7.default.dim("agentgates email pricing")} ${import_picocolors7.default.dim("\xB7 inboxes free on a balance, sends per message")}
|
|
35935
36070
|
`);
|
|
35936
|
-
put(` ${
|
|
36071
|
+
put(` ${import_picocolors7.default.dim("agentgates --help")} ${import_picocolors7.default.dim("\xB7 everything else")}
|
|
35937
36072
|
|
|
35938
36073
|
`);
|
|
35939
36074
|
}
|
|
35940
36075
|
|
|
35941
36076
|
// src/commands/logout.ts
|
|
35942
|
-
var
|
|
36077
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
35943
36078
|
async function logout(opts) {
|
|
35944
36079
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35945
36080
|
const resolved = await resolveProfile(requested);
|
|
35946
36081
|
if (!resolved) {
|
|
35947
|
-
process.stdout.write(
|
|
36082
|
+
process.stdout.write(import_picocolors8.default.dim("Not logged in \u2014 nothing to log out.\n"));
|
|
35948
36083
|
return;
|
|
35949
36084
|
}
|
|
35950
36085
|
if (resolved.autoSelected) {
|
|
35951
|
-
process.stderr.write(
|
|
36086
|
+
process.stderr.write(import_picocolors8.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35952
36087
|
`));
|
|
35953
36088
|
}
|
|
35954
36089
|
const { profile, name: profileName } = resolved;
|
|
@@ -35973,15 +36108,15 @@ async function logout(opts) {
|
|
|
35973
36108
|
const removed = await deleteProfile(profileName);
|
|
35974
36109
|
if (removed) {
|
|
35975
36110
|
process.stdout.write(
|
|
35976
|
-
|
|
36111
|
+
import_picocolors8.default.green(`\u2713 Logged out of profile ${import_picocolors8.default.bold(profileName)}.
|
|
35977
36112
|
`)
|
|
35978
36113
|
);
|
|
35979
36114
|
}
|
|
35980
36115
|
if (serverError) {
|
|
35981
36116
|
process.stderr.write(
|
|
35982
|
-
|
|
36117
|
+
import_picocolors8.default.yellow(
|
|
35983
36118
|
`\u26A0 Couldn't revoke server-side: ${serverError}
|
|
35984
|
-
The local bearer is wiped. If the server still has it, revoke from ${
|
|
36119
|
+
The local bearer is wiped. If the server still has it, revoke from ${import_picocolors8.default.bold("agentgates.ai/settings/pairings")}.
|
|
35985
36120
|
`
|
|
35986
36121
|
)
|
|
35987
36122
|
);
|
|
@@ -35989,16 +36124,16 @@ async function logout(opts) {
|
|
|
35989
36124
|
}
|
|
35990
36125
|
|
|
35991
36126
|
// src/commands/whoami.ts
|
|
35992
|
-
var
|
|
36127
|
+
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
35993
36128
|
async function whoami(opts) {
|
|
35994
36129
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35995
36130
|
const resolved = await resolveProfile(requested);
|
|
35996
36131
|
if (!resolved) {
|
|
35997
|
-
process.stderr.write(
|
|
36132
|
+
process.stderr.write(import_picocolors9.default.red("Not logged in. Run agentgates login first.\n"));
|
|
35998
36133
|
process.exit(2);
|
|
35999
36134
|
}
|
|
36000
36135
|
if (resolved.autoSelected) {
|
|
36001
|
-
process.stderr.write(
|
|
36136
|
+
process.stderr.write(import_picocolors9.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36002
36137
|
`));
|
|
36003
36138
|
}
|
|
36004
36139
|
const { profile, name: profileName } = resolved;
|
|
@@ -36007,7 +36142,7 @@ async function whoami(opts) {
|
|
|
36007
36142
|
profile,
|
|
36008
36143
|
profileName,
|
|
36009
36144
|
jsonMode,
|
|
36010
|
-
ttyHeader:
|
|
36145
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36011
36146
|
fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
|
|
36012
36147
|
});
|
|
36013
36148
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36017,14 +36152,14 @@ async function whoami(opts) {
|
|
|
36017
36152
|
);
|
|
36018
36153
|
process.exit(1);
|
|
36019
36154
|
}
|
|
36020
|
-
process.stderr.write(
|
|
36155
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${outcome.reason}.
|
|
36021
36156
|
`));
|
|
36022
36157
|
process.exit(1);
|
|
36023
36158
|
}
|
|
36024
36159
|
if (outcome.kind === "error") {
|
|
36025
36160
|
const err = outcome.error;
|
|
36026
36161
|
if (err instanceof ApiError) {
|
|
36027
|
-
process.stderr.write(
|
|
36162
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36028
36163
|
`));
|
|
36029
36164
|
process.exit(1);
|
|
36030
36165
|
}
|
|
@@ -36045,7 +36180,7 @@ async function whoami(opts) {
|
|
|
36045
36180
|
process.stdout.write(`Solana ${me.solanaAddress}
|
|
36046
36181
|
`);
|
|
36047
36182
|
}
|
|
36048
|
-
process.stdout.write(`Scopes ${me.scopes.join(", ") ||
|
|
36183
|
+
process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors9.default.dim("(none)")}
|
|
36049
36184
|
`);
|
|
36050
36185
|
const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
|
|
36051
36186
|
const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
|
|
@@ -36062,7 +36197,7 @@ async function whoami(opts) {
|
|
|
36062
36197
|
`
|
|
36063
36198
|
);
|
|
36064
36199
|
process.stdout.write(
|
|
36065
|
-
`Profile ${profileName === DEFAULT_PROFILE ?
|
|
36200
|
+
`Profile ${profileName === DEFAULT_PROFILE ? import_picocolors9.default.dim("(default)") : profileName}
|
|
36066
36201
|
`
|
|
36067
36202
|
);
|
|
36068
36203
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36076,7 +36211,7 @@ function formatDate(iso) {
|
|
|
36076
36211
|
}
|
|
36077
36212
|
|
|
36078
36213
|
// src/commands/send.ts
|
|
36079
|
-
var
|
|
36214
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
36080
36215
|
|
|
36081
36216
|
// src/lib/status.ts
|
|
36082
36217
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -36226,11 +36361,11 @@ async function send(amount, asset, opts) {
|
|
|
36226
36361
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36227
36362
|
const resolved = await resolveProfile(requested);
|
|
36228
36363
|
if (!resolved) {
|
|
36229
|
-
process.stderr.write(
|
|
36364
|
+
process.stderr.write(import_picocolors10.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36230
36365
|
process.exit(2);
|
|
36231
36366
|
}
|
|
36232
36367
|
if (resolved.autoSelected) {
|
|
36233
|
-
process.stderr.write(
|
|
36368
|
+
process.stderr.write(import_picocolors10.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36234
36369
|
`));
|
|
36235
36370
|
}
|
|
36236
36371
|
const { profile, name: profileName } = resolved;
|
|
@@ -36239,7 +36374,7 @@ async function send(amount, asset, opts) {
|
|
|
36239
36374
|
const amountNumber = Number(amount);
|
|
36240
36375
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
36241
36376
|
process.stderr.write(
|
|
36242
|
-
|
|
36377
|
+
import_picocolors10.default.red(`\u2715 amount must be a positive number (got ${import_picocolors10.default.bold(amount)}).
|
|
36243
36378
|
`)
|
|
36244
36379
|
);
|
|
36245
36380
|
process.exit(2);
|
|
@@ -36247,23 +36382,23 @@ async function send(amount, asset, opts) {
|
|
|
36247
36382
|
const assetNormalized = asset.toLowerCase();
|
|
36248
36383
|
if (assetNormalized !== "native" && assetNormalized !== "usdc") {
|
|
36249
36384
|
process.stderr.write(
|
|
36250
|
-
|
|
36251
|
-
`\u2715 asset must be ${
|
|
36385
|
+
import_picocolors10.default.red(
|
|
36386
|
+
`\u2715 asset must be ${import_picocolors10.default.bold("native")} or ${import_picocolors10.default.bold("usdc")} (got ${import_picocolors10.default.bold(asset)}).
|
|
36252
36387
|
`
|
|
36253
36388
|
)
|
|
36254
36389
|
);
|
|
36255
36390
|
process.exit(2);
|
|
36256
36391
|
}
|
|
36257
36392
|
if (!opts.to || opts.to.trim() === "") {
|
|
36258
|
-
process.stderr.write(
|
|
36393
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 --to <address> is required.
|
|
36259
36394
|
`));
|
|
36260
36395
|
process.exit(2);
|
|
36261
36396
|
}
|
|
36262
36397
|
if (isSolanaChainAlias(opts.chain)) {
|
|
36263
36398
|
if (EVM_ADDRESS_RE.test(opts.to)) {
|
|
36264
36399
|
process.stderr.write(
|
|
36265
|
-
|
|
36266
|
-
`\u2715 --to looks like an EVM address (0x-hex), but --chain is ${
|
|
36400
|
+
import_picocolors10.default.red(
|
|
36401
|
+
`\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
36402
|
`
|
|
36268
36403
|
)
|
|
36269
36404
|
);
|
|
@@ -36271,10 +36406,10 @@ async function send(amount, asset, opts) {
|
|
|
36271
36406
|
}
|
|
36272
36407
|
if (!SOLANA_ADDRESS_RE.test(opts.to)) {
|
|
36273
36408
|
process.stderr.write(
|
|
36274
|
-
|
|
36275
|
-
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${
|
|
36409
|
+
import_picocolors10.default.red(
|
|
36410
|
+
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${import_picocolors10.default.bold(opts.to)}).
|
|
36276
36411
|
`
|
|
36277
|
-
) +
|
|
36412
|
+
) + import_picocolors10.default.dim(
|
|
36278
36413
|
` SNS resolution is deferred to a future server-side change;
|
|
36279
36414
|
for now Solana sends require the literal pubkey.
|
|
36280
36415
|
`
|
|
@@ -36285,8 +36420,8 @@ async function send(amount, asset, opts) {
|
|
|
36285
36420
|
}
|
|
36286
36421
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
36287
36422
|
process.stderr.write(
|
|
36288
|
-
|
|
36289
|
-
`) +
|
|
36423
|
+
import_picocolors10.default.red(`\u2715 --user-stated <text> is required.
|
|
36424
|
+
`) + import_picocolors10.default.dim(
|
|
36290
36425
|
` This is the trust-gap defense: pass the verbatim user request so
|
|
36291
36426
|
the approval modal can cross-check what the agent thinks the user
|
|
36292
36427
|
asked for vs. the actual decoded transaction.
|
|
@@ -36304,7 +36439,7 @@ async function send(amount, asset, opts) {
|
|
|
36304
36439
|
const n = Number(opts.maxUsd);
|
|
36305
36440
|
if (!Number.isFinite(n) || n <= 0) {
|
|
36306
36441
|
process.stderr.write(
|
|
36307
|
-
|
|
36442
|
+
import_picocolors10.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
|
|
36308
36443
|
`)
|
|
36309
36444
|
);
|
|
36310
36445
|
process.exit(2);
|
|
@@ -36346,7 +36481,7 @@ async function send(amount, asset, opts) {
|
|
|
36346
36481
|
profile: profileName,
|
|
36347
36482
|
jsonMode,
|
|
36348
36483
|
origin: activeProfile.mcpOrigin,
|
|
36349
|
-
ttyHeader:
|
|
36484
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
36350
36485
|
});
|
|
36351
36486
|
} catch (reloginErr) {
|
|
36352
36487
|
if (jsonMode) {
|
|
@@ -36358,7 +36493,7 @@ async function send(amount, asset, opts) {
|
|
|
36358
36493
|
process.exit(1);
|
|
36359
36494
|
}
|
|
36360
36495
|
process.stderr.write(
|
|
36361
|
-
|
|
36496
|
+
import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36362
36497
|
`)
|
|
36363
36498
|
);
|
|
36364
36499
|
process.exit(1);
|
|
@@ -36382,7 +36517,7 @@ async function send(amount, asset, opts) {
|
|
|
36382
36517
|
process.exit(1);
|
|
36383
36518
|
}
|
|
36384
36519
|
process.stderr.write(
|
|
36385
|
-
|
|
36520
|
+
import_picocolors10.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
36386
36521
|
`)
|
|
36387
36522
|
);
|
|
36388
36523
|
process.exit(1);
|
|
@@ -36399,7 +36534,7 @@ async function send(amount, asset, opts) {
|
|
|
36399
36534
|
});
|
|
36400
36535
|
process.exit(1);
|
|
36401
36536
|
}
|
|
36402
|
-
process.stderr.write(
|
|
36537
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36403
36538
|
`));
|
|
36404
36539
|
process.exit(1);
|
|
36405
36540
|
} else {
|
|
@@ -36425,17 +36560,17 @@ async function send(amount, asset, opts) {
|
|
|
36425
36560
|
if (proposed.detail) {
|
|
36426
36561
|
const d = proposed.detail;
|
|
36427
36562
|
process.stderr.write(
|
|
36428
|
-
|
|
36563
|
+
import_picocolors10.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
|
|
36429
36564
|
`
|
|
36430
36565
|
);
|
|
36431
36566
|
} else {
|
|
36432
|
-
process.stderr.write(
|
|
36567
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${proposed.reason}
|
|
36433
36568
|
`));
|
|
36434
36569
|
}
|
|
36435
36570
|
if (proposed.upgrade_url) {
|
|
36436
36571
|
process.stderr.write(
|
|
36437
36572
|
` Open this to grant access, then re-run the command:
|
|
36438
|
-
${
|
|
36573
|
+
${import_picocolors10.default.cyan(proposed.upgrade_url)}
|
|
36439
36574
|
`
|
|
36440
36575
|
);
|
|
36441
36576
|
}
|
|
@@ -36445,21 +36580,21 @@ async function send(amount, asset, opts) {
|
|
|
36445
36580
|
const a = proposed.recommended_actions[i];
|
|
36446
36581
|
process.stderr.write(` ${i + 1}. ${a.label}
|
|
36447
36582
|
`);
|
|
36448
|
-
if (a.reasoning) process.stderr.write(
|
|
36583
|
+
if (a.reasoning) process.stderr.write(import_picocolors10.default.dim(` ${a.reasoning}
|
|
36449
36584
|
`));
|
|
36450
36585
|
if (a.action_intent && a.action_intent.external_url) {
|
|
36451
36586
|
process.stderr.write(
|
|
36452
|
-
` ${
|
|
36587
|
+
` ${import_picocolors10.default.cyan(a.action_intent.external_url)}
|
|
36453
36588
|
`
|
|
36454
36589
|
);
|
|
36455
36590
|
}
|
|
36456
36591
|
}
|
|
36457
36592
|
}
|
|
36458
36593
|
if (proposed.suggestions && proposed.suggestions.length > 0) {
|
|
36459
|
-
process.stderr.write(
|
|
36594
|
+
process.stderr.write(import_picocolors10.default.dim("\n Other ways to fund:\n"));
|
|
36460
36595
|
for (const s of proposed.suggestions) {
|
|
36461
36596
|
if (s.kind === "ask_user") continue;
|
|
36462
|
-
process.stderr.write(
|
|
36597
|
+
process.stderr.write(import_picocolors10.default.dim(` \u2022 ${s.label}
|
|
36463
36598
|
`));
|
|
36464
36599
|
}
|
|
36465
36600
|
}
|
|
@@ -36486,8 +36621,8 @@ async function send(amount, asset, opts) {
|
|
|
36486
36621
|
} else {
|
|
36487
36622
|
process.stdout.write(
|
|
36488
36623
|
`
|
|
36489
|
-
${
|
|
36490
|
-
${
|
|
36624
|
+
${import_picocolors10.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
36625
|
+
${import_picocolors10.default.cyan(proposed.approval_url)}
|
|
36491
36626
|
|
|
36492
36627
|
`
|
|
36493
36628
|
);
|
|
@@ -36506,7 +36641,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36506
36641
|
if (jsonMode) {
|
|
36507
36642
|
emitNdjson({ status: s.status, intent_id: s.approval_id });
|
|
36508
36643
|
} else {
|
|
36509
|
-
process.stdout.write(` ${describeStatus(s.status)}${
|
|
36644
|
+
process.stdout.write(` ${describeStatus(s.status)}${import_picocolors10.default.dim("\u2026")}\r`);
|
|
36510
36645
|
}
|
|
36511
36646
|
}
|
|
36512
36647
|
});
|
|
@@ -36520,7 +36655,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36520
36655
|
profile: profileName,
|
|
36521
36656
|
jsonMode,
|
|
36522
36657
|
origin: activeProfile.mcpOrigin,
|
|
36523
|
-
ttyHeader:
|
|
36658
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
|
|
36524
36659
|
});
|
|
36525
36660
|
} catch (reloginErr) {
|
|
36526
36661
|
if (jsonMode) {
|
|
@@ -36533,7 +36668,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36533
36668
|
process.exit(1);
|
|
36534
36669
|
}
|
|
36535
36670
|
process.stderr.write(
|
|
36536
|
-
"\n" +
|
|
36671
|
+
"\n" + import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36537
36672
|
`)
|
|
36538
36673
|
);
|
|
36539
36674
|
process.exit(1);
|
|
@@ -36551,7 +36686,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36551
36686
|
process.exit(1);
|
|
36552
36687
|
}
|
|
36553
36688
|
process.stderr.write(
|
|
36554
|
-
"\n" +
|
|
36689
|
+
"\n" + import_picocolors10.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
36555
36690
|
`)
|
|
36556
36691
|
);
|
|
36557
36692
|
process.exit(1);
|
|
@@ -36567,7 +36702,7 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36567
36702
|
process.exit(1);
|
|
36568
36703
|
}
|
|
36569
36704
|
process.stderr.write(
|
|
36570
|
-
"\n" +
|
|
36705
|
+
"\n" + import_picocolors10.default.red(`\u2715 Status poll failed: ${err.message}
|
|
36571
36706
|
`)
|
|
36572
36707
|
);
|
|
36573
36708
|
process.exit(1);
|
|
@@ -36587,19 +36722,19 @@ ${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36587
36722
|
}
|
|
36588
36723
|
process.stdout.write("\n");
|
|
36589
36724
|
if (final.status === "mined") {
|
|
36590
|
-
process.stdout.write(
|
|
36725
|
+
process.stdout.write(import_picocolors10.default.green("\u2713 Mined.") + "\n");
|
|
36591
36726
|
if (final.tx_hash) {
|
|
36592
36727
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
36593
36728
|
`);
|
|
36594
36729
|
}
|
|
36595
36730
|
if (explorer) {
|
|
36596
|
-
process.stdout.write(` Explorer ${
|
|
36731
|
+
process.stdout.write(` Explorer ${import_picocolors10.default.cyan(explorer)}
|
|
36597
36732
|
`);
|
|
36598
36733
|
}
|
|
36599
36734
|
process.exit(0);
|
|
36600
36735
|
}
|
|
36601
36736
|
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(
|
|
36737
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${label}.
|
|
36603
36738
|
`));
|
|
36604
36739
|
process.exit(1);
|
|
36605
36740
|
}
|
|
@@ -36627,7 +36762,7 @@ function describeStatus(s) {
|
|
|
36627
36762
|
}
|
|
36628
36763
|
|
|
36629
36764
|
// src/commands/status.ts
|
|
36630
|
-
var
|
|
36765
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
36631
36766
|
var WATCH_GIVEUP_MS = 10 * 6e4;
|
|
36632
36767
|
function explorerUrl2(chainId, hash) {
|
|
36633
36768
|
switch (chainId) {
|
|
@@ -36645,17 +36780,17 @@ function explorerUrl2(chainId, hash) {
|
|
|
36645
36780
|
}
|
|
36646
36781
|
async function status(intentId, opts) {
|
|
36647
36782
|
if (!intentId || intentId.trim() === "") {
|
|
36648
|
-
process.stderr.write(
|
|
36783
|
+
process.stderr.write(import_picocolors11.default.red("\u2715 Missing intent id.\n"));
|
|
36649
36784
|
process.exit(2);
|
|
36650
36785
|
}
|
|
36651
36786
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36652
36787
|
const resolved = await resolveProfile(requested);
|
|
36653
36788
|
if (!resolved) {
|
|
36654
|
-
process.stderr.write(
|
|
36789
|
+
process.stderr.write(import_picocolors11.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36655
36790
|
process.exit(2);
|
|
36656
36791
|
}
|
|
36657
36792
|
if (resolved.autoSelected) {
|
|
36658
|
-
process.stderr.write(
|
|
36793
|
+
process.stderr.write(import_picocolors11.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36659
36794
|
`));
|
|
36660
36795
|
}
|
|
36661
36796
|
const { profile, name: profileName } = resolved;
|
|
@@ -36664,7 +36799,7 @@ async function status(intentId, opts) {
|
|
|
36664
36799
|
profile,
|
|
36665
36800
|
profileName,
|
|
36666
36801
|
jsonMode,
|
|
36667
|
-
ttyHeader:
|
|
36802
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36668
36803
|
fn: (bearer, origin) => fetchStatus({ intentId, bearer, origin })
|
|
36669
36804
|
});
|
|
36670
36805
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36674,7 +36809,7 @@ async function status(intentId, opts) {
|
|
|
36674
36809
|
);
|
|
36675
36810
|
process.exit(1);
|
|
36676
36811
|
}
|
|
36677
|
-
process.stderr.write(
|
|
36812
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${outcome.reason}.
|
|
36678
36813
|
`));
|
|
36679
36814
|
process.exit(1);
|
|
36680
36815
|
}
|
|
@@ -36682,11 +36817,11 @@ async function status(intentId, opts) {
|
|
|
36682
36817
|
const err = outcome.error;
|
|
36683
36818
|
if (err instanceof ApiError) {
|
|
36684
36819
|
if (err.status === 404) {
|
|
36685
|
-
process.stderr.write(
|
|
36820
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 No intent with id ${intentId}.
|
|
36686
36821
|
`));
|
|
36687
36822
|
process.exit(1);
|
|
36688
36823
|
}
|
|
36689
|
-
process.stderr.write(
|
|
36824
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36690
36825
|
`));
|
|
36691
36826
|
process.exit(1);
|
|
36692
36827
|
}
|
|
@@ -36697,7 +36832,7 @@ async function status(intentId, opts) {
|
|
|
36697
36832
|
if (opts.watch && !isTerminalStatus(snap.status)) {
|
|
36698
36833
|
if (!jsonMode) {
|
|
36699
36834
|
printSnap(snap);
|
|
36700
|
-
process.stdout.write(
|
|
36835
|
+
process.stdout.write(import_picocolors11.default.dim("Watching\u2026\n"));
|
|
36701
36836
|
}
|
|
36702
36837
|
const runWatchPoll = (p) => streamStatusUntilTerminal({
|
|
36703
36838
|
intentId,
|
|
@@ -36708,7 +36843,7 @@ async function status(intentId, opts) {
|
|
|
36708
36843
|
giveUpMs: WATCH_GIVEUP_MS,
|
|
36709
36844
|
onTick: (s) => {
|
|
36710
36845
|
if (!jsonMode) {
|
|
36711
|
-
process.stdout.write(` ${
|
|
36846
|
+
process.stdout.write(` ${import_picocolors11.default.dim("\u2192")} ${s.status}
|
|
36712
36847
|
`);
|
|
36713
36848
|
}
|
|
36714
36849
|
}
|
|
@@ -36723,7 +36858,7 @@ async function status(intentId, opts) {
|
|
|
36723
36858
|
profile: profileName,
|
|
36724
36859
|
jsonMode,
|
|
36725
36860
|
origin: activeProfile.mcpOrigin,
|
|
36726
|
-
ttyHeader:
|
|
36861
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
|
|
36727
36862
|
});
|
|
36728
36863
|
} catch (reloginErr) {
|
|
36729
36864
|
if (jsonMode) {
|
|
@@ -36737,7 +36872,7 @@ async function status(intentId, opts) {
|
|
|
36737
36872
|
process.exit(1);
|
|
36738
36873
|
}
|
|
36739
36874
|
process.stderr.write(
|
|
36740
|
-
|
|
36875
|
+
import_picocolors11.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36741
36876
|
`)
|
|
36742
36877
|
);
|
|
36743
36878
|
process.exit(1);
|
|
@@ -36745,12 +36880,12 @@ async function status(intentId, opts) {
|
|
|
36745
36880
|
try {
|
|
36746
36881
|
final = await runWatchPoll(activeProfile);
|
|
36747
36882
|
} catch (retryErr) {
|
|
36748
|
-
process.stderr.write(
|
|
36883
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${retryErr.message}
|
|
36749
36884
|
`));
|
|
36750
36885
|
process.exit(1);
|
|
36751
36886
|
}
|
|
36752
36887
|
} else {
|
|
36753
|
-
process.stderr.write(
|
|
36888
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message}
|
|
36754
36889
|
`));
|
|
36755
36890
|
process.exit(1);
|
|
36756
36891
|
}
|
|
@@ -36771,7 +36906,7 @@ async function status(intentId, opts) {
|
|
|
36771
36906
|
}
|
|
36772
36907
|
function printSnap(s) {
|
|
36773
36908
|
const explorer = s.tx_hash ? explorerUrl2(s.chain_id, s.tx_hash) : null;
|
|
36774
|
-
const colorFn = s.status === "mined" ?
|
|
36909
|
+
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
36910
|
process.stdout.write(`Intent ${s.approval_id}
|
|
36776
36911
|
`);
|
|
36777
36912
|
process.stdout.write(`Status ${colorFn(s.status)}
|
|
@@ -36786,12 +36921,12 @@ function printSnap(s) {
|
|
|
36786
36921
|
process.stdout.write(`Tx ${s.tx_hash}
|
|
36787
36922
|
`);
|
|
36788
36923
|
if (explorer) {
|
|
36789
|
-
process.stdout.write(`Explorer ${
|
|
36924
|
+
process.stdout.write(`Explorer ${import_picocolors11.default.cyan(explorer)}
|
|
36790
36925
|
`);
|
|
36791
36926
|
}
|
|
36792
36927
|
}
|
|
36793
36928
|
if (!isTerminalStatus(s.status)) {
|
|
36794
|
-
process.stdout.write(`Approve ${
|
|
36929
|
+
process.stdout.write(`Approve ${import_picocolors11.default.cyan(s.approval_url)}
|
|
36795
36930
|
`);
|
|
36796
36931
|
}
|
|
36797
36932
|
process.stdout.write(`Created ${formatDate2(s.created_at)}
|
|
@@ -36808,7 +36943,7 @@ function formatDate2(iso) {
|
|
|
36808
36943
|
}
|
|
36809
36944
|
|
|
36810
36945
|
// src/commands/balance.ts
|
|
36811
|
-
var
|
|
36946
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
36812
36947
|
var CHAIN_ALIASES = {
|
|
36813
36948
|
"1": 1,
|
|
36814
36949
|
ethereum: 1,
|
|
@@ -36831,11 +36966,11 @@ async function balance(opts) {
|
|
|
36831
36966
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36832
36967
|
const resolved = await resolveProfile(requested);
|
|
36833
36968
|
if (!resolved) {
|
|
36834
|
-
process.stderr.write(
|
|
36969
|
+
process.stderr.write(import_picocolors12.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36835
36970
|
process.exit(2);
|
|
36836
36971
|
}
|
|
36837
36972
|
if (resolved.autoSelected) {
|
|
36838
|
-
process.stderr.write(
|
|
36973
|
+
process.stderr.write(import_picocolors12.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36839
36974
|
`));
|
|
36840
36975
|
}
|
|
36841
36976
|
const { profile, name: profileName } = resolved;
|
|
@@ -36845,8 +36980,8 @@ async function balance(opts) {
|
|
|
36845
36980
|
const id = CHAIN_ALIASES[key];
|
|
36846
36981
|
if (id === void 0) {
|
|
36847
36982
|
process.stderr.write(
|
|
36848
|
-
|
|
36849
|
-
`\u2715 Unknown chain ${
|
|
36983
|
+
import_picocolors12.default.red(
|
|
36984
|
+
`\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
36985
|
`
|
|
36851
36986
|
)
|
|
36852
36987
|
);
|
|
@@ -36859,7 +36994,7 @@ async function balance(opts) {
|
|
|
36859
36994
|
profile,
|
|
36860
36995
|
profileName,
|
|
36861
36996
|
jsonMode,
|
|
36862
|
-
ttyHeader:
|
|
36997
|
+
ttyHeader: import_picocolors12.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36863
36998
|
fn: (bearer, origin) => apiFetch("/api/balances", { bearer, origin })
|
|
36864
36999
|
});
|
|
36865
37000
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36869,14 +37004,14 @@ async function balance(opts) {
|
|
|
36869
37004
|
);
|
|
36870
37005
|
process.exit(1);
|
|
36871
37006
|
}
|
|
36872
|
-
process.stderr.write(
|
|
37007
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${outcome.reason}.
|
|
36873
37008
|
`));
|
|
36874
37009
|
process.exit(1);
|
|
36875
37010
|
}
|
|
36876
37011
|
if (outcome.kind === "error") {
|
|
36877
37012
|
const err = outcome.error;
|
|
36878
37013
|
if (err instanceof ApiError) {
|
|
36879
|
-
process.stderr.write(
|
|
37014
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36880
37015
|
`));
|
|
36881
37016
|
process.exit(1);
|
|
36882
37017
|
}
|
|
@@ -36906,7 +37041,7 @@ async function balance(opts) {
|
|
|
36906
37041
|
}
|
|
36907
37042
|
if (filtered.length === 0) {
|
|
36908
37043
|
process.stdout.write(
|
|
36909
|
-
|
|
37044
|
+
import_picocolors12.default.dim(
|
|
36910
37045
|
chainFilter !== null ? `No balances on chain ${chainFilter}.
|
|
36911
37046
|
` : `No chain balances returned.
|
|
36912
37047
|
`
|
|
@@ -36918,7 +37053,7 @@ async function balance(opts) {
|
|
|
36918
37053
|
const errorLines = [];
|
|
36919
37054
|
for (const c of filtered) {
|
|
36920
37055
|
if (c.error) {
|
|
36921
|
-
errorLines.push(`${c.chainName} ${
|
|
37056
|
+
errorLines.push(`${c.chainName} ${import_picocolors12.default.red(`(read failed: ${c.error})`)}`);
|
|
36922
37057
|
continue;
|
|
36923
37058
|
}
|
|
36924
37059
|
if (c.native.balance > 0) {
|
|
@@ -36939,7 +37074,7 @@ async function balance(opts) {
|
|
|
36939
37074
|
}
|
|
36940
37075
|
}
|
|
36941
37076
|
if (rows.length === 0 && errorLines.length === 0) {
|
|
36942
|
-
process.stdout.write(
|
|
37077
|
+
process.stdout.write(import_picocolors12.default.dim(`All balances are zero.
|
|
36943
37078
|
`));
|
|
36944
37079
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
36945
37080
|
return;
|
|
@@ -36949,7 +37084,7 @@ async function balance(opts) {
|
|
|
36949
37084
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36950
37085
|
const colBalance = Math.max(7, ...rows.map((r) => r.balance.length));
|
|
36951
37086
|
const header = "Chain".padEnd(colChain) + " " + "Asset".padEnd(colAsset) + " " + "Balance".padStart(colBalance);
|
|
36952
|
-
process.stdout.write(
|
|
37087
|
+
process.stdout.write(import_picocolors12.default.dim(header) + "\n");
|
|
36953
37088
|
for (const r of rows) {
|
|
36954
37089
|
process.stdout.write(
|
|
36955
37090
|
r.chain.padEnd(colChain) + " " + r.asset.padEnd(colAsset) + " " + r.balance.padStart(colBalance) + "\n"
|
|
@@ -36962,7 +37097,7 @@ async function balance(opts) {
|
|
|
36962
37097
|
`);
|
|
36963
37098
|
}
|
|
36964
37099
|
if (res.fetched_at) {
|
|
36965
|
-
process.stdout.write("\n" +
|
|
37100
|
+
process.stdout.write("\n" + import_picocolors12.default.dim(`Fetched ${res.fetched_at}
|
|
36966
37101
|
`));
|
|
36967
37102
|
}
|
|
36968
37103
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36975,18 +37110,18 @@ function formatBalance(value, decimals) {
|
|
|
36975
37110
|
}
|
|
36976
37111
|
|
|
36977
37112
|
// src/commands/history.ts
|
|
36978
|
-
var
|
|
37113
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
36979
37114
|
var DEFAULT_LIMIT = 20;
|
|
36980
37115
|
var SERVER_MAX_LIMIT = 100;
|
|
36981
37116
|
async function history(opts) {
|
|
36982
37117
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36983
37118
|
const resolved = await resolveProfile(requested);
|
|
36984
37119
|
if (!resolved) {
|
|
36985
|
-
process.stderr.write(
|
|
37120
|
+
process.stderr.write(import_picocolors13.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36986
37121
|
process.exit(2);
|
|
36987
37122
|
}
|
|
36988
37123
|
if (resolved.autoSelected) {
|
|
36989
|
-
process.stderr.write(
|
|
37124
|
+
process.stderr.write(import_picocolors13.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36990
37125
|
`));
|
|
36991
37126
|
}
|
|
36992
37127
|
const { profile, name: profileName } = resolved;
|
|
@@ -36995,14 +37130,14 @@ async function history(opts) {
|
|
|
36995
37130
|
const n = Number(opts.limit);
|
|
36996
37131
|
if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
|
|
36997
37132
|
process.stderr.write(
|
|
36998
|
-
|
|
37133
|
+
import_picocolors13.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors13.default.bold(opts.limit)}).
|
|
36999
37134
|
`)
|
|
37000
37135
|
);
|
|
37001
37136
|
process.exit(2);
|
|
37002
37137
|
}
|
|
37003
37138
|
if (n > SERVER_MAX_LIMIT) {
|
|
37004
37139
|
process.stderr.write(
|
|
37005
|
-
|
|
37140
|
+
import_picocolors13.default.red(
|
|
37006
37141
|
`\u2715 --limit max is ${SERVER_MAX_LIMIT} (the server's wallet://history hard cap). Got ${n}.
|
|
37007
37142
|
`
|
|
37008
37143
|
)
|
|
@@ -37016,7 +37151,7 @@ async function history(opts) {
|
|
|
37016
37151
|
profile,
|
|
37017
37152
|
profileName,
|
|
37018
37153
|
jsonMode,
|
|
37019
|
-
ttyHeader:
|
|
37154
|
+
ttyHeader: import_picocolors13.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
37020
37155
|
fn: (bearer, origin) => apiFetch(
|
|
37021
37156
|
`/api/history?limit=${encodeURIComponent(String(limit))}`,
|
|
37022
37157
|
{ bearer, origin }
|
|
@@ -37029,14 +37164,14 @@ async function history(opts) {
|
|
|
37029
37164
|
);
|
|
37030
37165
|
process.exit(1);
|
|
37031
37166
|
}
|
|
37032
|
-
process.stderr.write(
|
|
37167
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${outcome.reason}.
|
|
37033
37168
|
`));
|
|
37034
37169
|
process.exit(1);
|
|
37035
37170
|
}
|
|
37036
37171
|
if (outcome.kind === "error") {
|
|
37037
37172
|
const err = outcome.error;
|
|
37038
37173
|
if (err instanceof ApiError) {
|
|
37039
|
-
process.stderr.write(
|
|
37174
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37040
37175
|
`));
|
|
37041
37176
|
process.exit(1);
|
|
37042
37177
|
}
|
|
@@ -37053,7 +37188,7 @@ async function history(opts) {
|
|
|
37053
37188
|
return;
|
|
37054
37189
|
}
|
|
37055
37190
|
if (res.txs.length === 0) {
|
|
37056
|
-
process.stdout.write(
|
|
37191
|
+
process.stdout.write(import_picocolors13.default.dim(`No activity yet.
|
|
37057
37192
|
`));
|
|
37058
37193
|
return;
|
|
37059
37194
|
}
|
|
@@ -37073,7 +37208,7 @@ async function history(opts) {
|
|
|
37073
37208
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
37074
37209
|
const colTo = Math.max(2, ...rows.map((r) => r.to.length));
|
|
37075
37210
|
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(
|
|
37211
|
+
process.stdout.write(import_picocolors13.default.dim(header) + "\n");
|
|
37077
37212
|
for (const r of rows) {
|
|
37078
37213
|
process.stdout.write(
|
|
37079
37214
|
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 +37216,7 @@ async function history(opts) {
|
|
|
37081
37216
|
}
|
|
37082
37217
|
if (res.fetched_at) {
|
|
37083
37218
|
process.stdout.write(
|
|
37084
|
-
"\n" +
|
|
37219
|
+
"\n" + import_picocolors13.default.dim(
|
|
37085
37220
|
`Showing ${rows.length} of limit ${res.limit ?? limit} \xB7 fetched ${res.fetched_at}
|
|
37086
37221
|
`
|
|
37087
37222
|
)
|
|
@@ -37168,10 +37303,10 @@ function prettyType(activityType, status2) {
|
|
|
37168
37303
|
}
|
|
37169
37304
|
|
|
37170
37305
|
// src/commands/swap.ts
|
|
37171
|
-
var
|
|
37306
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
37172
37307
|
|
|
37173
37308
|
// src/lib/intent-flow.ts
|
|
37174
|
-
var
|
|
37309
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
37175
37310
|
var STREAM_GIVEUP_MS = 10 * 6e4;
|
|
37176
37311
|
var SOLANA_CHAIN_ID2 = 900;
|
|
37177
37312
|
function isBlocked2(r) {
|
|
@@ -37246,7 +37381,7 @@ async function runIntentFlow(opts) {
|
|
|
37246
37381
|
profile: opts.profileName,
|
|
37247
37382
|
jsonMode: opts.jsonMode,
|
|
37248
37383
|
origin: activeProfile.mcpOrigin,
|
|
37249
|
-
ttyHeader:
|
|
37384
|
+
ttyHeader: import_picocolors14.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
37250
37385
|
});
|
|
37251
37386
|
} catch (reloginErr) {
|
|
37252
37387
|
if (opts.jsonMode) {
|
|
@@ -37258,7 +37393,7 @@ async function runIntentFlow(opts) {
|
|
|
37258
37393
|
process.exit(1);
|
|
37259
37394
|
}
|
|
37260
37395
|
process.stderr.write(
|
|
37261
|
-
|
|
37396
|
+
import_picocolors14.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37262
37397
|
`)
|
|
37263
37398
|
);
|
|
37264
37399
|
process.exit(1);
|
|
@@ -37282,7 +37417,7 @@ async function runIntentFlow(opts) {
|
|
|
37282
37417
|
process.exit(1);
|
|
37283
37418
|
}
|
|
37284
37419
|
process.stderr.write(
|
|
37285
|
-
|
|
37420
|
+
import_picocolors14.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
37286
37421
|
`)
|
|
37287
37422
|
);
|
|
37288
37423
|
process.exit(1);
|
|
@@ -37299,7 +37434,7 @@ async function runIntentFlow(opts) {
|
|
|
37299
37434
|
});
|
|
37300
37435
|
process.exit(1);
|
|
37301
37436
|
}
|
|
37302
|
-
process.stderr.write(
|
|
37437
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37303
37438
|
`));
|
|
37304
37439
|
process.exit(1);
|
|
37305
37440
|
} else {
|
|
@@ -37321,18 +37456,18 @@ async function runIntentFlow(opts) {
|
|
|
37321
37456
|
});
|
|
37322
37457
|
process.exit(1);
|
|
37323
37458
|
}
|
|
37324
|
-
process.stderr.write(
|
|
37459
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
|
|
37325
37460
|
`));
|
|
37326
37461
|
if (proposed.upgrade_url) {
|
|
37327
37462
|
process.stderr.write(
|
|
37328
37463
|
` Open this to grant access, then re-run the command:
|
|
37329
|
-
${
|
|
37464
|
+
${import_picocolors14.default.cyan(proposed.upgrade_url)}
|
|
37330
37465
|
`
|
|
37331
37466
|
);
|
|
37332
37467
|
}
|
|
37333
37468
|
if (proposed.recommended_actions && proposed.recommended_actions.length > 0) {
|
|
37334
37469
|
process.stderr.write(
|
|
37335
|
-
|
|
37470
|
+
import_picocolors14.default.dim(
|
|
37336
37471
|
` Suggested actions:
|
|
37337
37472
|
` + proposed.recommended_actions.map((a) => ` \u2022 ${JSON.stringify(a)}`).join("\n") + "\n"
|
|
37338
37473
|
)
|
|
@@ -37355,8 +37490,8 @@ async function runIntentFlow(opts) {
|
|
|
37355
37490
|
} else {
|
|
37356
37491
|
process.stdout.write(
|
|
37357
37492
|
`
|
|
37358
|
-
${
|
|
37359
|
-
${
|
|
37493
|
+
${import_picocolors14.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
37494
|
+
${import_picocolors14.default.cyan(proposed.approval_url)}
|
|
37360
37495
|
|
|
37361
37496
|
`
|
|
37362
37497
|
);
|
|
@@ -37378,7 +37513,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37378
37513
|
if (opts.jsonMode) {
|
|
37379
37514
|
emitNdjson2({ status: s.status, intent_id: s.approval_id });
|
|
37380
37515
|
} else {
|
|
37381
|
-
process.stdout.write(` ${describeStatus2(s.status)}${
|
|
37516
|
+
process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors14.default.dim("\u2026")}\r`);
|
|
37382
37517
|
}
|
|
37383
37518
|
}
|
|
37384
37519
|
});
|
|
@@ -37392,7 +37527,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37392
37527
|
profile: opts.profileName,
|
|
37393
37528
|
jsonMode: opts.jsonMode,
|
|
37394
37529
|
origin: activeProfile.mcpOrigin,
|
|
37395
|
-
ttyHeader:
|
|
37530
|
+
ttyHeader: import_picocolors14.default.dim(
|
|
37396
37531
|
"Bearer expired mid-poll \u2014 re-pairing this terminal\u2026"
|
|
37397
37532
|
)
|
|
37398
37533
|
});
|
|
@@ -37407,7 +37542,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37407
37542
|
process.exit(1);
|
|
37408
37543
|
}
|
|
37409
37544
|
process.stderr.write(
|
|
37410
|
-
"\n" +
|
|
37545
|
+
"\n" + import_picocolors14.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37411
37546
|
`)
|
|
37412
37547
|
);
|
|
37413
37548
|
process.exit(1);
|
|
@@ -37425,7 +37560,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37425
37560
|
process.exit(1);
|
|
37426
37561
|
}
|
|
37427
37562
|
process.stderr.write(
|
|
37428
|
-
"\n" +
|
|
37563
|
+
"\n" + import_picocolors14.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
37429
37564
|
`)
|
|
37430
37565
|
);
|
|
37431
37566
|
process.exit(1);
|
|
@@ -37441,7 +37576,7 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37441
37576
|
process.exit(1);
|
|
37442
37577
|
}
|
|
37443
37578
|
process.stderr.write(
|
|
37444
|
-
"\n" +
|
|
37579
|
+
"\n" + import_picocolors14.default.red(`\u2715 Status poll failed: ${err.message}
|
|
37445
37580
|
`)
|
|
37446
37581
|
);
|
|
37447
37582
|
process.exit(1);
|
|
@@ -37482,39 +37617,39 @@ ${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37482
37617
|
process.stdout.write("\n");
|
|
37483
37618
|
const printLegJournal = () => {
|
|
37484
37619
|
if (legs.length === 0) return;
|
|
37485
|
-
process.stdout.write(
|
|
37620
|
+
process.stdout.write(import_picocolors14.default.bold(" Legs:\n"));
|
|
37486
37621
|
for (const l of legs) {
|
|
37487
|
-
const line = l.status === "mined" ?
|
|
37622
|
+
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
37623
|
process.stdout.write(` ${line}
|
|
37489
37624
|
`);
|
|
37490
37625
|
}
|
|
37491
37626
|
};
|
|
37492
37627
|
if (final.status === "mined") {
|
|
37493
|
-
process.stdout.write(
|
|
37628
|
+
process.stdout.write(import_picocolors14.default.green("\u2713 Mined.") + "\n");
|
|
37494
37629
|
if (final.tx_hash) {
|
|
37495
37630
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
37496
37631
|
`);
|
|
37497
37632
|
}
|
|
37498
37633
|
if (explorer) {
|
|
37499
|
-
process.stdout.write(` Explorer ${
|
|
37634
|
+
process.stdout.write(` Explorer ${import_picocolors14.default.cyan(explorer)}
|
|
37500
37635
|
`);
|
|
37501
37636
|
}
|
|
37502
37637
|
printLegJournal();
|
|
37503
37638
|
process.exit(0);
|
|
37504
37639
|
}
|
|
37505
37640
|
if (final.status === "failed" && failure?.message) {
|
|
37506
|
-
process.stderr.write(
|
|
37641
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${failure.message}
|
|
37507
37642
|
`));
|
|
37508
37643
|
if (retryCommand) {
|
|
37509
37644
|
process.stderr.write(` Retry:
|
|
37510
|
-
${
|
|
37645
|
+
${import_picocolors14.default.cyan(retryCommand)}
|
|
37511
37646
|
`);
|
|
37512
37647
|
}
|
|
37513
37648
|
printLegJournal();
|
|
37514
37649
|
process.exit(1);
|
|
37515
37650
|
}
|
|
37516
37651
|
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(
|
|
37652
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${label}.
|
|
37518
37653
|
`));
|
|
37519
37654
|
printLegJournal();
|
|
37520
37655
|
process.exit(1);
|
|
@@ -37534,7 +37669,7 @@ function isAsset(v) {
|
|
|
37534
37669
|
return ASSET_VALUES.has(v.toLowerCase());
|
|
37535
37670
|
}
|
|
37536
37671
|
function failArg(msg) {
|
|
37537
|
-
process.stderr.write(
|
|
37672
|
+
process.stderr.write(import_picocolors15.default.red(`\u2715 ${msg}
|
|
37538
37673
|
`));
|
|
37539
37674
|
process.exit(2);
|
|
37540
37675
|
}
|
|
@@ -37542,11 +37677,11 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37542
37677
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37543
37678
|
const resolved = await resolveProfile(requested);
|
|
37544
37679
|
if (!resolved) {
|
|
37545
|
-
process.stderr.write(
|
|
37680
|
+
process.stderr.write(import_picocolors15.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37546
37681
|
process.exit(2);
|
|
37547
37682
|
}
|
|
37548
37683
|
if (resolved.autoSelected) {
|
|
37549
|
-
process.stderr.write(
|
|
37684
|
+
process.stderr.write(import_picocolors15.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37550
37685
|
`));
|
|
37551
37686
|
}
|
|
37552
37687
|
const { profile, name: profileName } = resolved;
|
|
@@ -37554,12 +37689,12 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37554
37689
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37555
37690
|
const amountNumber = Number(amount);
|
|
37556
37691
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37557
|
-
failArg(`amount must be a positive number (got ${
|
|
37692
|
+
failArg(`amount must be a positive number (got ${import_picocolors15.default.bold(amount)}).`);
|
|
37558
37693
|
}
|
|
37559
37694
|
const fromAssetNorm = fromAsset.toLowerCase();
|
|
37560
37695
|
if (!isAsset(fromAssetNorm)) {
|
|
37561
37696
|
failArg(
|
|
37562
|
-
`from-asset must be ${
|
|
37697
|
+
`from-asset must be ${import_picocolors15.default.bold("native")} or ${import_picocolors15.default.bold("usdc")} (got ${import_picocolors15.default.bold(fromAsset)}).`
|
|
37563
37698
|
);
|
|
37564
37699
|
}
|
|
37565
37700
|
if (!opts.toAsset) {
|
|
@@ -37568,7 +37703,7 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37568
37703
|
const toAssetNorm = opts.toAsset.toLowerCase();
|
|
37569
37704
|
if (!isAsset(toAssetNorm)) {
|
|
37570
37705
|
failArg(
|
|
37571
|
-
`--to-asset must be ${
|
|
37706
|
+
`--to-asset must be ${import_picocolors15.default.bold("native")} or ${import_picocolors15.default.bold("usdc")} (got ${import_picocolors15.default.bold(opts.toAsset)}).`
|
|
37572
37707
|
);
|
|
37573
37708
|
}
|
|
37574
37709
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37697,9 +37832,9 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37697
37832
|
}
|
|
37698
37833
|
|
|
37699
37834
|
// src/commands/batch.ts
|
|
37700
|
-
var
|
|
37835
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
37701
37836
|
function failArg2(msg) {
|
|
37702
|
-
process.stderr.write(
|
|
37837
|
+
process.stderr.write(import_picocolors16.default.red(`\u2715 ${msg}
|
|
37703
37838
|
`));
|
|
37704
37839
|
process.exit(2);
|
|
37705
37840
|
}
|
|
@@ -37707,7 +37842,7 @@ async function batch(opts) {
|
|
|
37707
37842
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37708
37843
|
const resolved = await resolveProfile(requested);
|
|
37709
37844
|
if (!resolved) {
|
|
37710
|
-
process.stderr.write(
|
|
37845
|
+
process.stderr.write(import_picocolors16.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37711
37846
|
process.exit(2);
|
|
37712
37847
|
}
|
|
37713
37848
|
const { name: profileName, profile } = resolved;
|
|
@@ -37761,14 +37896,14 @@ async function batch(opts) {
|
|
|
37761
37896
|
}
|
|
37762
37897
|
|
|
37763
37898
|
// src/commands/fund-wallet.ts
|
|
37764
|
-
var
|
|
37899
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
37765
37900
|
var EVM_ADDRESS_RE2 = /^0x[0-9a-fA-F]{40}$/;
|
|
37766
37901
|
var SOLANA_ADDRESS_RE2 = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
37767
37902
|
function isAddressTarget(target) {
|
|
37768
37903
|
return EVM_ADDRESS_RE2.test(target) || SOLANA_ADDRESS_RE2.test(target);
|
|
37769
37904
|
}
|
|
37770
37905
|
function failArg3(msg) {
|
|
37771
|
-
process.stderr.write(
|
|
37906
|
+
process.stderr.write(import_picocolors17.default.red(`\u2715 ${msg}
|
|
37772
37907
|
`));
|
|
37773
37908
|
process.exit(2);
|
|
37774
37909
|
}
|
|
@@ -37776,7 +37911,7 @@ async function fundWallet(address, opts) {
|
|
|
37776
37911
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37777
37912
|
const resolved = await resolveProfile(requested);
|
|
37778
37913
|
if (!resolved) {
|
|
37779
|
-
process.stderr.write(
|
|
37914
|
+
process.stderr.write(import_picocolors17.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37780
37915
|
process.exit(2);
|
|
37781
37916
|
}
|
|
37782
37917
|
const { name: profileName, profile } = resolved;
|
|
@@ -37853,11 +37988,11 @@ async function fundWallet(address, opts) {
|
|
|
37853
37988
|
}
|
|
37854
37989
|
|
|
37855
37990
|
// src/commands/earn-supply.ts
|
|
37856
|
-
var
|
|
37991
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
37857
37992
|
var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37858
37993
|
var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37859
37994
|
function failArg4(msg) {
|
|
37860
|
-
process.stderr.write(
|
|
37995
|
+
process.stderr.write(import_picocolors18.default.red(`\u2715 ${msg}
|
|
37861
37996
|
`));
|
|
37862
37997
|
process.exit(2);
|
|
37863
37998
|
}
|
|
@@ -37865,11 +38000,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37865
38000
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37866
38001
|
const resolved = await resolveProfile(requested);
|
|
37867
38002
|
if (!resolved) {
|
|
37868
|
-
process.stderr.write(
|
|
38003
|
+
process.stderr.write(import_picocolors18.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37869
38004
|
process.exit(2);
|
|
37870
38005
|
}
|
|
37871
38006
|
if (resolved.autoSelected) {
|
|
37872
|
-
process.stderr.write(
|
|
38007
|
+
process.stderr.write(import_picocolors18.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37873
38008
|
`));
|
|
37874
38009
|
}
|
|
37875
38010
|
const { profile, name: profileName } = resolved;
|
|
@@ -37877,12 +38012,12 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37877
38012
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37878
38013
|
const amountNumber = Number(amount);
|
|
37879
38014
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37880
|
-
failArg4(`amount must be a positive number (got ${
|
|
38015
|
+
failArg4(`amount must be a positive number (got ${import_picocolors18.default.bold(amount)}).`);
|
|
37881
38016
|
}
|
|
37882
38017
|
const assetNorm = asset.toLowerCase();
|
|
37883
38018
|
if (!ASSET_VALUES2.has(assetNorm)) {
|
|
37884
38019
|
failArg4(
|
|
37885
|
-
`asset must be ${
|
|
38020
|
+
`asset must be ${import_picocolors18.default.bold("native")} or ${import_picocolors18.default.bold("usdc")} (got ${import_picocolors18.default.bold(asset)}).`
|
|
37886
38021
|
);
|
|
37887
38022
|
}
|
|
37888
38023
|
if (!opts.chain) {
|
|
@@ -37894,7 +38029,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37894
38029
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37895
38030
|
if (!PROTOCOLS.has(protocolNorm)) {
|
|
37896
38031
|
failArg4(
|
|
37897
|
-
`--protocol must be ${
|
|
38032
|
+
`--protocol must be ${import_picocolors18.default.bold("aave_v3")} or ${import_picocolors18.default.bold("kamino_lend")} (got ${import_picocolors18.default.bold(opts.protocol)}).`
|
|
37898
38033
|
);
|
|
37899
38034
|
}
|
|
37900
38035
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37946,11 +38081,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37946
38081
|
}
|
|
37947
38082
|
|
|
37948
38083
|
// src/commands/earn-withdraw.ts
|
|
37949
|
-
var
|
|
38084
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
37950
38085
|
var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37951
38086
|
var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37952
38087
|
function failArg5(msg) {
|
|
37953
|
-
process.stderr.write(
|
|
38088
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${msg}
|
|
37954
38089
|
`));
|
|
37955
38090
|
process.exit(2);
|
|
37956
38091
|
}
|
|
@@ -37958,11 +38093,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37958
38093
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37959
38094
|
const resolved = await resolveProfile(requested);
|
|
37960
38095
|
if (!resolved) {
|
|
37961
|
-
process.stderr.write(
|
|
38096
|
+
process.stderr.write(import_picocolors19.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37962
38097
|
process.exit(2);
|
|
37963
38098
|
}
|
|
37964
38099
|
if (resolved.autoSelected) {
|
|
37965
|
-
process.stderr.write(
|
|
38100
|
+
process.stderr.write(import_picocolors19.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37966
38101
|
`));
|
|
37967
38102
|
}
|
|
37968
38103
|
const { profile, name: profileName } = resolved;
|
|
@@ -37973,14 +38108,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37973
38108
|
const amountNumber = Number(amountOrMax);
|
|
37974
38109
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37975
38110
|
failArg5(
|
|
37976
|
-
`<amount-or-max> must be a positive number or the literal string "max" (got ${
|
|
38111
|
+
`<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors19.default.bold(amountOrMax)}).`
|
|
37977
38112
|
);
|
|
37978
38113
|
}
|
|
37979
38114
|
}
|
|
37980
38115
|
const assetNorm = asset.toLowerCase();
|
|
37981
38116
|
if (!ASSET_VALUES3.has(assetNorm)) {
|
|
37982
38117
|
failArg5(
|
|
37983
|
-
`asset must be ${
|
|
38118
|
+
`asset must be ${import_picocolors19.default.bold("native")} or ${import_picocolors19.default.bold("usdc")} (got ${import_picocolors19.default.bold(asset)}).`
|
|
37984
38119
|
);
|
|
37985
38120
|
}
|
|
37986
38121
|
if (!opts.chain) {
|
|
@@ -37992,7 +38127,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37992
38127
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37993
38128
|
if (!PROTOCOLS2.has(protocolNorm)) {
|
|
37994
38129
|
failArg5(
|
|
37995
|
-
`--protocol must be ${
|
|
38130
|
+
`--protocol must be ${import_picocolors19.default.bold("aave_v3")} or ${import_picocolors19.default.bold("kamino_lend")} (got ${import_picocolors19.default.bold(opts.protocol)}).`
|
|
37996
38131
|
);
|
|
37997
38132
|
}
|
|
37998
38133
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -38044,7 +38179,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
38044
38179
|
}
|
|
38045
38180
|
|
|
38046
38181
|
// src/commands/eat.ts
|
|
38047
|
-
var
|
|
38182
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
38048
38183
|
function parseLineJson(values) {
|
|
38049
38184
|
const lines = [];
|
|
38050
38185
|
for (const value of values) {
|
|
@@ -38071,11 +38206,11 @@ function parseLineJson(values) {
|
|
|
38071
38206
|
async function loadResolvedProfile(requested) {
|
|
38072
38207
|
const resolved = await resolveProfile(requested);
|
|
38073
38208
|
if (!resolved) {
|
|
38074
|
-
process.stderr.write(
|
|
38209
|
+
process.stderr.write(import_picocolors20.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38075
38210
|
process.exit(2);
|
|
38076
38211
|
}
|
|
38077
38212
|
if (resolved.autoSelected) {
|
|
38078
|
-
process.stderr.write(
|
|
38213
|
+
process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38079
38214
|
`));
|
|
38080
38215
|
}
|
|
38081
38216
|
return resolved;
|
|
@@ -38086,12 +38221,12 @@ function printResult(res, jsonMode) {
|
|
|
38086
38221
|
return;
|
|
38087
38222
|
}
|
|
38088
38223
|
if (res.blocked) {
|
|
38089
|
-
process.stderr.write(
|
|
38224
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
|
|
38090
38225
|
`));
|
|
38091
38226
|
if (res.upgrade_url) {
|
|
38092
38227
|
process.stderr.write(
|
|
38093
38228
|
` Open this to grant access, then re-run the command:
|
|
38094
|
-
${
|
|
38229
|
+
${import_picocolors20.default.cyan(res.upgrade_url)}
|
|
38095
38230
|
`
|
|
38096
38231
|
);
|
|
38097
38232
|
}
|
|
@@ -38122,7 +38257,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38122
38257
|
profile: resolved.profile,
|
|
38123
38258
|
profileName: resolved.name,
|
|
38124
38259
|
jsonMode,
|
|
38125
|
-
ttyHeader:
|
|
38260
|
+
ttyHeader: import_picocolors20.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38126
38261
|
fn: (bearer, origin) => apiFetch(path5, { method: "POST", bearer, origin, body })
|
|
38127
38262
|
});
|
|
38128
38263
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38132,7 +38267,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38132
38267
|
);
|
|
38133
38268
|
process.exit(1);
|
|
38134
38269
|
}
|
|
38135
|
-
process.stderr.write(
|
|
38270
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${outcome.reason}.
|
|
38136
38271
|
`));
|
|
38137
38272
|
process.exit(1);
|
|
38138
38273
|
}
|
|
@@ -38145,7 +38280,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38145
38280
|
);
|
|
38146
38281
|
process.exit(1);
|
|
38147
38282
|
}
|
|
38148
|
-
process.stderr.write(
|
|
38283
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38149
38284
|
`));
|
|
38150
38285
|
process.exit(1);
|
|
38151
38286
|
}
|
|
@@ -38158,7 +38293,7 @@ async function searchFood(opts) {
|
|
|
38158
38293
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38159
38294
|
if (!opts.location && !opts.name) {
|
|
38160
38295
|
process.stderr.write(
|
|
38161
|
-
|
|
38296
|
+
import_picocolors20.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
|
|
38162
38297
|
);
|
|
38163
38298
|
process.exit(2);
|
|
38164
38299
|
}
|
|
@@ -38179,7 +38314,7 @@ async function menuFood(items, opts) {
|
|
|
38179
38314
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38180
38315
|
if (!opts.brand || !opts.address) {
|
|
38181
38316
|
process.stderr.write(
|
|
38182
|
-
|
|
38317
|
+
import_picocolors20.default.red(
|
|
38183
38318
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38184
38319
|
)
|
|
38185
38320
|
);
|
|
@@ -38199,7 +38334,7 @@ async function orderFood(items, opts) {
|
|
|
38199
38334
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38200
38335
|
if (!opts.brand || !opts.address) {
|
|
38201
38336
|
process.stderr.write(
|
|
38202
|
-
|
|
38337
|
+
import_picocolors20.default.red(
|
|
38203
38338
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38204
38339
|
)
|
|
38205
38340
|
);
|
|
@@ -38209,14 +38344,14 @@ async function orderFood(items, opts) {
|
|
|
38209
38344
|
try {
|
|
38210
38345
|
structuredLines = parseLineJson(opts.lineJson ?? []);
|
|
38211
38346
|
} catch (e) {
|
|
38212
|
-
process.stderr.write(
|
|
38347
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
|
|
38213
38348
|
`));
|
|
38214
38349
|
process.exit(2);
|
|
38215
38350
|
}
|
|
38216
38351
|
const lines = [...items ?? [], ...structuredLines];
|
|
38217
38352
|
if (lines.length === 0) {
|
|
38218
38353
|
process.stderr.write(
|
|
38219
|
-
|
|
38354
|
+
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
38355
|
);
|
|
38221
38356
|
process.exit(2);
|
|
38222
38357
|
}
|
|
@@ -38250,7 +38385,7 @@ async function orderFood(items, opts) {
|
|
|
38250
38385
|
if (!agentCard.will_attempt) {
|
|
38251
38386
|
if (!jsonMode) {
|
|
38252
38387
|
process.stderr.write(
|
|
38253
|
-
|
|
38388
|
+
import_picocolors20.default.yellow(
|
|
38254
38389
|
`This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
|
|
38255
38390
|
`
|
|
38256
38391
|
)
|
|
@@ -38267,7 +38402,7 @@ async function orderFood(items, opts) {
|
|
|
38267
38402
|
}
|
|
38268
38403
|
if (verdict.status === "paid") {
|
|
38269
38404
|
process.stdout.write(
|
|
38270
|
-
|
|
38405
|
+
import_picocolors20.default.green(
|
|
38271
38406
|
`Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
|
|
38272
38407
|
)
|
|
38273
38408
|
);
|
|
@@ -38275,7 +38410,7 @@ async function orderFood(items, opts) {
|
|
|
38275
38410
|
}
|
|
38276
38411
|
if (verdict.status === "failed") {
|
|
38277
38412
|
process.stderr.write(
|
|
38278
|
-
|
|
38413
|
+
import_picocolors20.default.yellow(
|
|
38279
38414
|
`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
38415
|
`
|
|
38281
38416
|
)
|
|
@@ -38285,7 +38420,7 @@ async function orderFood(items, opts) {
|
|
|
38285
38420
|
}
|
|
38286
38421
|
if (verdict.status === "unconfirmed") {
|
|
38287
38422
|
process.stderr.write(
|
|
38288
|
-
|
|
38423
|
+
import_picocolors20.default.red(
|
|
38289
38424
|
"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
38425
|
` : "")
|
|
38291
38426
|
)
|
|
@@ -38294,7 +38429,7 @@ async function orderFood(items, opts) {
|
|
|
38294
38429
|
return;
|
|
38295
38430
|
}
|
|
38296
38431
|
process.stderr.write(
|
|
38297
|
-
|
|
38432
|
+
import_picocolors20.default.dim(
|
|
38298
38433
|
`Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
|
|
38299
38434
|
)
|
|
38300
38435
|
);
|
|
@@ -38319,7 +38454,7 @@ var POLL_BUDGET_MS = 1e5;
|
|
|
38319
38454
|
var POLL_INTERVAL_MS2 = 3500;
|
|
38320
38455
|
async function pollOrderVerdict(orderId, resolved, jsonMode) {
|
|
38321
38456
|
if (!jsonMode) {
|
|
38322
|
-
process.stderr.write(
|
|
38457
|
+
process.stderr.write(import_picocolors20.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
|
|
38323
38458
|
}
|
|
38324
38459
|
const deadline = Date.now() + POLL_BUDGET_MS;
|
|
38325
38460
|
let last = {
|
|
@@ -38389,16 +38524,16 @@ async function statusFood(orderId, opts) {
|
|
|
38389
38524
|
}
|
|
38390
38525
|
|
|
38391
38526
|
// src/commands/bounties.ts
|
|
38392
|
-
var
|
|
38527
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
38393
38528
|
async function withProfile(opts, path5, init) {
|
|
38394
38529
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38395
38530
|
const resolved = await resolveProfile(requested);
|
|
38396
38531
|
if (!resolved) {
|
|
38397
|
-
process.stderr.write(
|
|
38532
|
+
process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38398
38533
|
process.exit(2);
|
|
38399
38534
|
}
|
|
38400
38535
|
if (resolved.autoSelected) {
|
|
38401
|
-
process.stderr.write(
|
|
38536
|
+
process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38402
38537
|
`));
|
|
38403
38538
|
}
|
|
38404
38539
|
const { profile, name: profileName } = resolved;
|
|
@@ -38407,7 +38542,7 @@ async function withProfile(opts, path5, init) {
|
|
|
38407
38542
|
profile,
|
|
38408
38543
|
profileName,
|
|
38409
38544
|
jsonMode,
|
|
38410
|
-
ttyHeader:
|
|
38545
|
+
ttyHeader: import_picocolors21.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38411
38546
|
fn: (bearer, origin) => apiFetch(path5, init ? { bearer, origin, method: init.method, body: init.body } : { bearer, origin })
|
|
38412
38547
|
});
|
|
38413
38548
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38415,14 +38550,14 @@ async function withProfile(opts, path5, init) {
|
|
|
38415
38550
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38416
38551
|
process.exit(1);
|
|
38417
38552
|
}
|
|
38418
|
-
process.stderr.write(
|
|
38553
|
+
process.stderr.write(import_picocolors21.default.red(`\u2715 ${outcome.reason}.
|
|
38419
38554
|
`));
|
|
38420
38555
|
process.exit(1);
|
|
38421
38556
|
}
|
|
38422
38557
|
if (outcome.kind === "error") {
|
|
38423
38558
|
const err = outcome.error;
|
|
38424
38559
|
if (err instanceof ApiError) {
|
|
38425
|
-
process.stderr.write(
|
|
38560
|
+
process.stderr.write(import_picocolors21.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38426
38561
|
`));
|
|
38427
38562
|
process.exit(1);
|
|
38428
38563
|
}
|
|
@@ -38436,12 +38571,12 @@ function handleBlocked(res, jsonMode) {
|
|
|
38436
38571
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38437
38572
|
process.exit(1);
|
|
38438
38573
|
}
|
|
38439
|
-
process.stderr.write(
|
|
38574
|
+
process.stderr.write(import_picocolors21.default.yellow(`
|
|
38440
38575
|
${res.reason ?? "Blocked."}
|
|
38441
38576
|
`));
|
|
38442
38577
|
if (res.upgrade_url) {
|
|
38443
38578
|
process.stderr.write(`
|
|
38444
|
-
${
|
|
38579
|
+
${import_picocolors21.default.bold(res.upgrade_url)}
|
|
38445
38580
|
|
|
38446
38581
|
`);
|
|
38447
38582
|
}
|
|
@@ -38484,14 +38619,14 @@ function printTable(rows) {
|
|
|
38484
38619
|
const cLeft = w("left", 4);
|
|
38485
38620
|
const cSubs = w("subs", 4);
|
|
38486
38621
|
process.stdout.write(
|
|
38487
|
-
|
|
38622
|
+
import_picocolors21.default.dim(
|
|
38488
38623
|
"Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
|
|
38489
38624
|
) + "\n"
|
|
38490
38625
|
);
|
|
38491
38626
|
for (const c of cells) {
|
|
38492
|
-
const title = c.live ?
|
|
38627
|
+
const title = c.live ? import_picocolors21.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
|
|
38493
38628
|
process.stdout.write(
|
|
38494
|
-
|
|
38629
|
+
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
38630
|
);
|
|
38496
38631
|
}
|
|
38497
38632
|
}
|
|
@@ -38503,11 +38638,11 @@ async function listBounties(opts) {
|
|
|
38503
38638
|
const min = opts.min !== void 0 ? Number(opts.min) : void 0;
|
|
38504
38639
|
const max = opts.max !== void 0 ? Number(opts.max) : void 0;
|
|
38505
38640
|
if (min !== void 0 && !Number.isFinite(min)) {
|
|
38506
|
-
process.stderr.write(
|
|
38641
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --min must be a number.\n"));
|
|
38507
38642
|
process.exit(2);
|
|
38508
38643
|
}
|
|
38509
38644
|
if (max !== void 0 && !Number.isFinite(max)) {
|
|
38510
|
-
process.stderr.write(
|
|
38645
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --max must be a number.\n"));
|
|
38511
38646
|
process.exit(2);
|
|
38512
38647
|
}
|
|
38513
38648
|
rows = rows.filter((r) => {
|
|
@@ -38532,7 +38667,7 @@ async function listBounties(opts) {
|
|
|
38532
38667
|
});
|
|
38533
38668
|
const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
|
|
38534
38669
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
38535
|
-
process.stderr.write(
|
|
38670
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --limit must be a positive number.\n"));
|
|
38536
38671
|
process.exit(2);
|
|
38537
38672
|
}
|
|
38538
38673
|
const shown = rows.slice(0, limit);
|
|
@@ -38541,13 +38676,13 @@ async function listBounties(opts) {
|
|
|
38541
38676
|
return;
|
|
38542
38677
|
}
|
|
38543
38678
|
if (shown.length === 0) {
|
|
38544
|
-
process.stdout.write(
|
|
38679
|
+
process.stdout.write(import_picocolors21.default.dim("No active bounties match.\n"));
|
|
38545
38680
|
return;
|
|
38546
38681
|
}
|
|
38547
38682
|
printTable(shown);
|
|
38548
38683
|
const clipped = rows.length - shown.length;
|
|
38549
38684
|
process.stdout.write(
|
|
38550
|
-
"\n" +
|
|
38685
|
+
"\n" + import_picocolors21.default.dim(
|
|
38551
38686
|
`${shown.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
|
|
38552
38687
|
`
|
|
38553
38688
|
)
|
|
@@ -38558,7 +38693,7 @@ async function showBounty(id, opts) {
|
|
|
38558
38693
|
const jsonMode = opts.json === true;
|
|
38559
38694
|
const clean = id.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
|
|
38560
38695
|
if (!clean) {
|
|
38561
|
-
process.stderr.write(
|
|
38696
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
|
|
38562
38697
|
process.exit(2);
|
|
38563
38698
|
}
|
|
38564
38699
|
const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean)}`);
|
|
@@ -38569,26 +38704,26 @@ async function showBounty(id, opts) {
|
|
|
38569
38704
|
}
|
|
38570
38705
|
const b = res.bounty;
|
|
38571
38706
|
if (!b) {
|
|
38572
|
-
process.stdout.write(
|
|
38707
|
+
process.stdout.write(import_picocolors21.default.dim("Not found.\n"));
|
|
38573
38708
|
return;
|
|
38574
38709
|
}
|
|
38575
|
-
process.stdout.write("\n" +
|
|
38710
|
+
process.stdout.write("\n" + import_picocolors21.default.bold(b.title) + "\n\n");
|
|
38576
38711
|
process.stdout.write(b.description + "\n\n");
|
|
38577
38712
|
process.stdout.write(
|
|
38578
|
-
|
|
38713
|
+
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
38714
|
);
|
|
38580
38715
|
if (b.claimsAllowed && b.claimsAllowed > 1) {
|
|
38581
38716
|
const left = Math.max(0, b.claimsAllowed - (b.claimsPaid ?? 0));
|
|
38582
38717
|
process.stdout.write(
|
|
38583
|
-
|
|
38718
|
+
import_picocolors21.default.dim(
|
|
38584
38719
|
`${left} of ${b.claimsAllowed} claims left` + (b.perClaimAmount != null ? `, ${fmtAmount(b.perClaimAmount)} each` : "")
|
|
38585
38720
|
) + "\n"
|
|
38586
38721
|
);
|
|
38587
38722
|
}
|
|
38588
|
-
if (b.evidenceType) process.stdout.write(
|
|
38589
|
-
if (b.expiresAt) process.stdout.write(
|
|
38723
|
+
if (b.evidenceType) process.stdout.write(import_picocolors21.default.dim(`Evidence required: ${b.evidenceType}`) + "\n");
|
|
38724
|
+
if (b.expiresAt) process.stdout.write(import_picocolors21.default.dim(`Expires in ${fmtExpiry(b.expiresAt)}`) + "\n");
|
|
38590
38725
|
if (b.geoLabel && b.geoScope !== "global") {
|
|
38591
|
-
process.stdout.write(
|
|
38726
|
+
process.stdout.write(import_picocolors21.default.dim(`Creator says: ${b.geoLabel}`) + "\n");
|
|
38592
38727
|
}
|
|
38593
38728
|
if (res.url) process.stdout.write("\n" + res.url + "\n");
|
|
38594
38729
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38606,7 +38741,7 @@ async function myBounties(opts) {
|
|
|
38606
38741
|
}
|
|
38607
38742
|
if (rows.length === 0) {
|
|
38608
38743
|
process.stdout.write(
|
|
38609
|
-
|
|
38744
|
+
import_picocolors21.default.dim(
|
|
38610
38745
|
status2 ? `No bounties of yours are ${status2}.
|
|
38611
38746
|
` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
|
|
38612
38747
|
)
|
|
@@ -38616,7 +38751,7 @@ async function myBounties(opts) {
|
|
|
38616
38751
|
printTable(rows);
|
|
38617
38752
|
const subs = res.submissions ?? [];
|
|
38618
38753
|
if (subs.length > 0) {
|
|
38619
|
-
process.stdout.write("\n" +
|
|
38754
|
+
process.stdout.write("\n" + import_picocolors21.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
|
|
38620
38755
|
`));
|
|
38621
38756
|
}
|
|
38622
38757
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38635,19 +38770,19 @@ async function bountyFeed(opts) {
|
|
|
38635
38770
|
}
|
|
38636
38771
|
const subs = res.submissions ?? [];
|
|
38637
38772
|
if (subs.length === 0) {
|
|
38638
|
-
process.stdout.write(
|
|
38773
|
+
process.stdout.write(import_picocolors21.default.dim("Nothing in the feed for that filter.\n"));
|
|
38639
38774
|
return;
|
|
38640
38775
|
}
|
|
38641
38776
|
process.stdout.write(
|
|
38642
|
-
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ?
|
|
38777
|
+
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors21.default.dim(" More available.") : "") + "\n"
|
|
38643
38778
|
);
|
|
38644
|
-
process.stdout.write(
|
|
38779
|
+
process.stdout.write(import_picocolors21.default.dim("Use --json for the full rows.\n"));
|
|
38645
38780
|
}
|
|
38646
38781
|
async function draftBounty(opts) {
|
|
38647
38782
|
const jsonMode = opts.json === true;
|
|
38648
38783
|
const amountNum = Number(opts.amount);
|
|
38649
38784
|
if (!Number.isFinite(amountNum) || amountNum <= 0) {
|
|
38650
|
-
process.stderr.write(
|
|
38785
|
+
process.stderr.write(import_picocolors21.default.red("\u2715 --amount must be a positive number of USDC.\n"));
|
|
38651
38786
|
process.exit(2);
|
|
38652
38787
|
}
|
|
38653
38788
|
const res = await withProfile(opts, "/api/bounties", {
|
|
@@ -38665,20 +38800,20 @@ async function draftBounty(opts) {
|
|
|
38665
38800
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38666
38801
|
return;
|
|
38667
38802
|
}
|
|
38668
|
-
process.stdout.write("\n" +
|
|
38803
|
+
process.stdout.write("\n" + import_picocolors21.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
|
|
38669
38804
|
|
|
38670
38805
|
`);
|
|
38671
|
-
process.stdout.write(
|
|
38806
|
+
process.stdout.write(import_picocolors21.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
|
|
38672
38807
|
if (res.fund_url) {
|
|
38673
|
-
process.stdout.write("\nFund it here:\n" +
|
|
38674
|
-
process.stdout.write(
|
|
38808
|
+
process.stdout.write("\nFund it here:\n" + import_picocolors21.default.bold(res.fund_url) + "\n\n");
|
|
38809
|
+
process.stdout.write(import_picocolors21.default.dim("Funding happens in your browser with your own wallet.\n"));
|
|
38675
38810
|
}
|
|
38676
38811
|
}
|
|
38677
38812
|
|
|
38678
38813
|
// src/commands/bounty-money.ts
|
|
38679
|
-
var
|
|
38814
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
38680
38815
|
function failArg6(message) {
|
|
38681
|
-
process.stderr.write(
|
|
38816
|
+
process.stderr.write(import_picocolors22.default.red(`${message}
|
|
38682
38817
|
`));
|
|
38683
38818
|
process.exit(2);
|
|
38684
38819
|
}
|
|
@@ -38690,12 +38825,12 @@ async function loadProfileOrExit(requested, jsonMode) {
|
|
|
38690
38825
|
JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
|
|
38691
38826
|
);
|
|
38692
38827
|
} else {
|
|
38693
|
-
process.stderr.write(
|
|
38828
|
+
process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38694
38829
|
}
|
|
38695
38830
|
process.exit(2);
|
|
38696
38831
|
}
|
|
38697
38832
|
if (resolved.autoSelected && !jsonMode) {
|
|
38698
|
-
process.stderr.write(
|
|
38833
|
+
process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38699
38834
|
`));
|
|
38700
38835
|
}
|
|
38701
38836
|
return { profile: resolved.profile, profileName: resolved.name };
|
|
@@ -38800,16 +38935,16 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
38800
38935
|
}
|
|
38801
38936
|
|
|
38802
38937
|
// src/commands/bounty-work.ts
|
|
38803
|
-
var
|
|
38938
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
38804
38939
|
async function runWork(path5, body, opts) {
|
|
38805
38940
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38806
38941
|
const resolved = await resolveProfile(requested);
|
|
38807
38942
|
if (!resolved) {
|
|
38808
|
-
process.stderr.write(
|
|
38943
|
+
process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38809
38944
|
process.exit(2);
|
|
38810
38945
|
}
|
|
38811
38946
|
if (resolved.autoSelected) {
|
|
38812
|
-
process.stderr.write(
|
|
38947
|
+
process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38813
38948
|
`));
|
|
38814
38949
|
}
|
|
38815
38950
|
const jsonMode = opts.json === true;
|
|
@@ -38817,7 +38952,7 @@ async function runWork(path5, body, opts) {
|
|
|
38817
38952
|
profile: resolved.profile,
|
|
38818
38953
|
profileName: resolved.name,
|
|
38819
38954
|
jsonMode,
|
|
38820
|
-
ttyHeader:
|
|
38955
|
+
ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38821
38956
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38822
38957
|
});
|
|
38823
38958
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38825,7 +38960,7 @@ async function runWork(path5, body, opts) {
|
|
|
38825
38960
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38826
38961
|
process.exit(1);
|
|
38827
38962
|
}
|
|
38828
|
-
process.stderr.write(
|
|
38963
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${outcome.reason}.
|
|
38829
38964
|
`));
|
|
38830
38965
|
process.exit(1);
|
|
38831
38966
|
}
|
|
@@ -38835,7 +38970,7 @@ async function runWork(path5, body, opts) {
|
|
|
38835
38970
|
if (jsonMode) {
|
|
38836
38971
|
process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
|
|
38837
38972
|
} else {
|
|
38838
|
-
process.stderr.write(
|
|
38973
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38839
38974
|
`));
|
|
38840
38975
|
}
|
|
38841
38976
|
process.exit(1);
|
|
@@ -38848,11 +38983,11 @@ async function runWork(path5, body, opts) {
|
|
|
38848
38983
|
process.stdout.write(JSON.stringify({ ok: false, ...data }) + "\n");
|
|
38849
38984
|
process.exit(1);
|
|
38850
38985
|
}
|
|
38851
|
-
process.stderr.write(
|
|
38986
|
+
process.stderr.write(import_picocolors23.default.yellow(`
|
|
38852
38987
|
${data.reason ?? "Blocked."}
|
|
38853
38988
|
`));
|
|
38854
38989
|
if (data.upgrade_url) process.stderr.write(`
|
|
38855
|
-
${
|
|
38990
|
+
${import_picocolors23.default.bold(data.upgrade_url)}
|
|
38856
38991
|
|
|
38857
38992
|
`);
|
|
38858
38993
|
process.exit(1);
|
|
@@ -38861,7 +38996,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38861
38996
|
if (jsonMode) {
|
|
38862
38997
|
process.stdout.write(JSON.stringify({ ok: false, error: data.error }) + "\n");
|
|
38863
38998
|
} else {
|
|
38864
|
-
process.stderr.write(
|
|
38999
|
+
process.stderr.write(import_picocolors23.default.red(`\u2715 ${data.error}
|
|
38865
39000
|
`));
|
|
38866
39001
|
}
|
|
38867
39002
|
process.exit(1);
|
|
@@ -38904,7 +39039,7 @@ async function bountyRetention(bountyId, opts) {
|
|
|
38904
39039
|
}
|
|
38905
39040
|
|
|
38906
39041
|
// src/commands/bounty-deliver.ts
|
|
38907
|
-
var
|
|
39042
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
38908
39043
|
import { spawn } from "node:child_process";
|
|
38909
39044
|
var FLUSH_MS = 400;
|
|
38910
39045
|
var FLUSH_BYTES = 2048;
|
|
@@ -38913,11 +39048,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38913
39048
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38914
39049
|
const resolved = await resolveProfile(requested);
|
|
38915
39050
|
if (!resolved) {
|
|
38916
|
-
process.stderr.write(
|
|
39051
|
+
process.stderr.write(import_picocolors24.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38917
39052
|
process.exit(2);
|
|
38918
39053
|
}
|
|
38919
39054
|
if (resolved.autoSelected && !jsonMode) {
|
|
38920
|
-
process.stderr.write(
|
|
39055
|
+
process.stderr.write(import_picocolors24.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38921
39056
|
`));
|
|
38922
39057
|
}
|
|
38923
39058
|
const post = async (path5, body) => {
|
|
@@ -38925,7 +39060,7 @@ async function deliver(bountyId, command, opts) {
|
|
|
38925
39060
|
profile: resolved.profile,
|
|
38926
39061
|
profileName: resolved.name,
|
|
38927
39062
|
jsonMode,
|
|
38928
|
-
ttyHeader:
|
|
39063
|
+
ttyHeader: import_picocolors24.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38929
39064
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38930
39065
|
});
|
|
38931
39066
|
if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
|
|
@@ -38936,11 +39071,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38936
39071
|
if (jsonMode) {
|
|
38937
39072
|
process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data ?? {} }) + "\n");
|
|
38938
39073
|
} else {
|
|
38939
|
-
process.stderr.write(
|
|
39074
|
+
process.stderr.write(import_picocolors24.default.red(`
|
|
38940
39075
|
\u2715 ${msg}
|
|
38941
39076
|
`));
|
|
38942
39077
|
if (data?.upgrade_url) process.stderr.write(`
|
|
38943
|
-
${
|
|
39078
|
+
${import_picocolors24.default.bold(data.upgrade_url)}
|
|
38944
39079
|
|
|
38945
39080
|
`);
|
|
38946
39081
|
}
|
|
@@ -38965,7 +39100,7 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
38965
39100
|
if (!runId) return void die("The service opened a run but did not name it.");
|
|
38966
39101
|
if (!jsonMode) {
|
|
38967
39102
|
process.stderr.write(
|
|
38968
|
-
|
|
39103
|
+
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
39104
|
|
|
38970
39105
|
`)
|
|
38971
39106
|
);
|
|
@@ -39017,10 +39152,10 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39017
39152
|
child.stdout.on("data", (d) => consume(d));
|
|
39018
39153
|
child.stderr.setEncoding("utf8");
|
|
39019
39154
|
child.stderr.on("data", (d) => {
|
|
39020
|
-
if (!jsonMode) process.stderr.write(
|
|
39155
|
+
if (!jsonMode) process.stderr.write(import_picocolors24.default.dim(d));
|
|
39021
39156
|
});
|
|
39022
39157
|
child.on("error", (err) => {
|
|
39023
|
-
process.stderr.write(
|
|
39158
|
+
process.stderr.write(import_picocolors24.default.red(`
|
|
39024
39159
|
\u2715 Could not run ${command[0]}: ${err.message}
|
|
39025
39160
|
`));
|
|
39026
39161
|
resolve(127);
|
|
@@ -39057,14 +39192,14 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39057
39192
|
}
|
|
39058
39193
|
if (appendFailure) {
|
|
39059
39194
|
process.stderr.write(
|
|
39060
|
-
|
|
39195
|
+
import_picocolors24.default.yellow(`
|
|
39061
39196
|
! Some output did not reach the page: ${appendFailure}
|
|
39062
|
-
`) +
|
|
39197
|
+
`) + import_picocolors24.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
|
|
39063
39198
|
);
|
|
39064
39199
|
}
|
|
39065
39200
|
if (exitCode) {
|
|
39066
39201
|
process.stderr.write(
|
|
39067
|
-
|
|
39202
|
+
import_picocolors24.default.yellow(`
|
|
39068
39203
|
! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
|
|
39069
39204
|
`)
|
|
39070
39205
|
);
|
|
@@ -39074,7 +39209,7 @@ ${import_picocolors23.default.bold(data.upgrade_url)}
|
|
|
39074
39209
|
}
|
|
39075
39210
|
|
|
39076
39211
|
// src/commands/trade.ts
|
|
39077
|
-
var
|
|
39212
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
39078
39213
|
|
|
39079
39214
|
// src/lib/trade-sol.ts
|
|
39080
39215
|
var import_web3 = __toESM(require_index_cjs(), 1);
|
|
@@ -39440,7 +39575,7 @@ function fail(message, json) {
|
|
|
39440
39575
|
if (json) {
|
|
39441
39576
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39442
39577
|
} else {
|
|
39443
|
-
process.stderr.write(
|
|
39578
|
+
process.stderr.write(import_picocolors25.default.red(`\u2715 ${message}
|
|
39444
39579
|
`));
|
|
39445
39580
|
}
|
|
39446
39581
|
process.exit(1);
|
|
@@ -39631,7 +39766,7 @@ async function tradeBuy(coinArg, amount, opts) {
|
|
|
39631
39766
|
}
|
|
39632
39767
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39633
39768
|
if (created && !opts.json) {
|
|
39634
|
-
process.stderr.write(
|
|
39769
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39635
39770
|
`));
|
|
39636
39771
|
}
|
|
39637
39772
|
const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
|
|
@@ -39685,7 +39820,7 @@ async function tradeOrderPlace(coinArg, opts) {
|
|
|
39685
39820
|
if (opts.mcap && !opts.at) fail("--mcap qualifies --at.", opts.json);
|
|
39686
39821
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39687
39822
|
if (created && !opts.json) {
|
|
39688
|
-
process.stderr.write(
|
|
39823
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39689
39824
|
`));
|
|
39690
39825
|
}
|
|
39691
39826
|
let amount;
|
|
@@ -39850,7 +39985,7 @@ async function tradePositions(opts) {
|
|
|
39850
39985
|
}
|
|
39851
39986
|
|
|
39852
39987
|
// src/commands/desk.ts
|
|
39853
|
-
var
|
|
39988
|
+
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
39854
39989
|
|
|
39855
39990
|
// src/lib/desk-sol.ts
|
|
39856
39991
|
var import_web32 = __toESM(require_index_cjs(), 1);
|
|
@@ -40024,7 +40159,7 @@ function fail2(message, json) {
|
|
|
40024
40159
|
if (json) {
|
|
40025
40160
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
40026
40161
|
} else {
|
|
40027
|
-
process.stderr.write(
|
|
40162
|
+
process.stderr.write(import_picocolors26.default.red(`\u2715 ${message}
|
|
40028
40163
|
`));
|
|
40029
40164
|
}
|
|
40030
40165
|
process.exit(1);
|
|
@@ -40167,7 +40302,7 @@ async function deskDeposit(amount, opts) {
|
|
|
40167
40302
|
if (units <= 0n) fail2("Deposit amount must be above zero.", opts.json);
|
|
40168
40303
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
40169
40304
|
if (created && !opts.json) {
|
|
40170
|
-
process.stderr.write(
|
|
40305
|
+
process.stderr.write(import_picocolors26.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
40171
40306
|
`));
|
|
40172
40307
|
}
|
|
40173
40308
|
const result = await runDeskCeremony({
|
|
@@ -40262,13 +40397,13 @@ async function deskSessionRegister(opts) {
|
|
|
40262
40397
|
}
|
|
40263
40398
|
const owner = await loadOrCreateTradeKey();
|
|
40264
40399
|
if (owner.created && !opts.json) {
|
|
40265
|
-
process.stderr.write(
|
|
40400
|
+
process.stderr.write(import_picocolors26.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
|
|
40266
40401
|
`));
|
|
40267
40402
|
}
|
|
40268
40403
|
const session = await loadOrCreateDeskSessionKey();
|
|
40269
40404
|
if (session.created && !opts.json) {
|
|
40270
40405
|
process.stderr.write(
|
|
40271
|
-
|
|
40406
|
+
import_picocolors26.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
|
|
40272
40407
|
`)
|
|
40273
40408
|
);
|
|
40274
40409
|
}
|
|
@@ -40810,7 +40945,7 @@ program2.command("fund").description(
|
|
|
40810
40945
|
}
|
|
40811
40946
|
if (opts.usdc || opts.gas || opts.chain) {
|
|
40812
40947
|
process.stderr.write(
|
|
40813
|
-
|
|
40948
|
+
import_picocolors27.default.red(
|
|
40814
40949
|
`\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
|
|
40815
40950
|
`
|
|
40816
40951
|
)
|
|
@@ -40929,7 +41064,7 @@ desk.command("buy").description("Buy a launch coin with desk USDC credit (sessio
|
|
|
40929
41064
|
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
41065
|
await deskSell(coin, amount, opts);
|
|
40931
41066
|
});
|
|
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) => {
|
|
41067
|
+
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
41068
|
await onboard(opts);
|
|
40934
41069
|
});
|
|
40935
41070
|
var compute = program2.command("compute").description("Confidential virtual machines by the hour, USDC per payment");
|
|
@@ -40953,11 +41088,21 @@ phone.command("pricing").description("Number plans, per-unit usage and the payph
|
|
|
40953
41088
|
phone.command("call").description("Place a payphone call (needs an x402 signature this CLI does not have yet)").action(async () => {
|
|
40954
41089
|
await phoneCall();
|
|
40955
41090
|
});
|
|
41091
|
+
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");
|
|
41092
|
+
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) => {
|
|
41093
|
+
await emailPricing(opts);
|
|
41094
|
+
});
|
|
41095
|
+
email.command("create").description("Create an inbox (needs the wallet's signature this CLI does not have yet)").action(async () => {
|
|
41096
|
+
await emailCreate();
|
|
41097
|
+
});
|
|
41098
|
+
email.command("send").description("Send from an inbox (needs the wallet's signature this CLI does not have yet)").action(async () => {
|
|
41099
|
+
await emailSend();
|
|
41100
|
+
});
|
|
40956
41101
|
program2.parseAsync(process.argv).catch((err) => {
|
|
40957
|
-
process.stderr.write(
|
|
41102
|
+
process.stderr.write(import_picocolors27.default.red(`\u2715 ${err.message}
|
|
40958
41103
|
`));
|
|
40959
41104
|
if (process.env.BOUNTY_DEBUG) {
|
|
40960
|
-
process.stderr.write(
|
|
41105
|
+
process.stderr.write(import_picocolors27.default.dim((err.stack ?? "") + "\n"));
|
|
40961
41106
|
}
|
|
40962
41107
|
process.exit(1);
|
|
40963
41108
|
});
|