@agentgates/cli 0.11.3 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +393 -269
- 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.12.0",
|
|
3122
3122
|
description: "Wallet operations for AI agents and humans",
|
|
3123
3123
|
keywords: [
|
|
3124
3124
|
"crypto",
|
|
@@ -34373,7 +34373,7 @@ var {
|
|
|
34373
34373
|
} = import_index.default;
|
|
34374
34374
|
|
|
34375
34375
|
// src/main.ts
|
|
34376
|
-
var
|
|
34376
|
+
var import_picocolors26 = __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_picocolors6 = __toESM(require_picocolors(), 1);
|
|
35350
35350
|
import { createInterface } from "node:readline/promises";
|
|
35351
35351
|
|
|
35352
35352
|
// src/lib/water.ts
|
|
@@ -35608,6 +35608,99 @@ async function inferenceAsk() {
|
|
|
35608
35608
|
);
|
|
35609
35609
|
}
|
|
35610
35610
|
|
|
35611
|
+
// src/commands/phone.ts
|
|
35612
|
+
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
35613
|
+
var SITE3 = (process.env.AGENTGATES_ORIGIN || "https://agentgates.ai").replace(/\/$/, "");
|
|
35614
|
+
var usd2 = (v) => {
|
|
35615
|
+
const n = Number(v);
|
|
35616
|
+
if (Number.isInteger(n)) return `$${n}`;
|
|
35617
|
+
const [whole, frac = ""] = n.toFixed(6).replace(/0+$/, "").split(".");
|
|
35618
|
+
return `$${whole}.${frac.padEnd(2, "0")}`;
|
|
35619
|
+
};
|
|
35620
|
+
function phoneSlice(body) {
|
|
35621
|
+
const { booth, ...rest } = body;
|
|
35622
|
+
const out = {
|
|
35623
|
+
...rest,
|
|
35624
|
+
products: (body.products ?? []).filter((p) => p.id === "phone"),
|
|
35625
|
+
rungs: (body.rungs ?? []).filter((r) => r.product === "phone"),
|
|
35626
|
+
prices: (body.prices ?? []).filter((p) => p.product === "phone")
|
|
35627
|
+
};
|
|
35628
|
+
if (booth?.call) out.booth = { brief: booth.brief, call: booth.call };
|
|
35629
|
+
delete out.payg;
|
|
35630
|
+
delete out.sendOverflow;
|
|
35631
|
+
return out;
|
|
35632
|
+
}
|
|
35633
|
+
async function phonePricing(opts) {
|
|
35634
|
+
const res = await fetch(`${SITE3}/api/identity/catalog`, { headers: { accept: "application/json" } });
|
|
35635
|
+
if (!res.ok) throw new Error(`phone catalog: HTTP ${res.status}`);
|
|
35636
|
+
const body = await res.json();
|
|
35637
|
+
const slice = phoneSlice(body);
|
|
35638
|
+
if (opts.json) {
|
|
35639
|
+
process.stdout.write(JSON.stringify(slice, null, 2) + "\n");
|
|
35640
|
+
return;
|
|
35641
|
+
}
|
|
35642
|
+
const product = slice.products?.[0];
|
|
35643
|
+
if (!product || product.available === false) {
|
|
35644
|
+
process.stdout.write(` ${import_picocolors5.default.dim(product?.brief || "Phone numbers are not on sale right now.")}
|
|
35645
|
+
`);
|
|
35646
|
+
return;
|
|
35647
|
+
}
|
|
35648
|
+
const plans = slice.prices ?? [];
|
|
35649
|
+
process.stdout.write(`
|
|
35650
|
+
${import_picocolors5.default.bold("PHONE NUMBERS")} ${import_picocolors5.default.dim("texts and calls, on a wallet plan")}
|
|
35651
|
+
|
|
35652
|
+
`);
|
|
35653
|
+
for (const p of plans) {
|
|
35654
|
+
const count = p.phones ?? 1;
|
|
35655
|
+
const price = usd2(p.priceUsd).padStart(4);
|
|
35656
|
+
const term = `/${p.units} days`.padEnd(9);
|
|
35657
|
+
process.stdout.write(` ${import_picocolors5.default.bold(p.rung.padEnd(11))} ${import_picocolors5.default.cyan(price)}${import_picocolors5.default.dim(term)} ${import_picocolors5.default.dim(`${count} number${count === 1 ? "" : "s"}`)}
|
|
35658
|
+
`);
|
|
35659
|
+
}
|
|
35660
|
+
if (plans.length === 0) process.stdout.write(` ${import_picocolors5.default.dim("no plan rungs are priced right now")}
|
|
35661
|
+
`);
|
|
35662
|
+
const u = slice.phoneUsage;
|
|
35663
|
+
if (u) {
|
|
35664
|
+
const meter = [
|
|
35665
|
+
u.textUsd ? `text ${usd2(u.textUsd)}` : "",
|
|
35666
|
+
u.minuteUsd ? `call minute ${usd2(u.minuteUsd)}` : "",
|
|
35667
|
+
u.waitCodeUsd !== void 0 ? `wait-code ${Number(u.waitCodeUsd) === 0 ? "free" : usd2(u.waitCodeUsd)}` : ""
|
|
35668
|
+
].filter(Boolean).join(" \xB7 ");
|
|
35669
|
+
process.stdout.write(`
|
|
35670
|
+
${import_picocolors5.default.dim(`usage, from the prepaid balance: ${meter}`)}
|
|
35671
|
+
`);
|
|
35672
|
+
if (u.sendingNote) process.stdout.write(` ${import_picocolors5.default.dim(u.sendingNote)}
|
|
35673
|
+
`);
|
|
35674
|
+
}
|
|
35675
|
+
const call = slice.booth?.call;
|
|
35676
|
+
const windows = call?.windows ?? [];
|
|
35677
|
+
if (call?.available && windows.length) {
|
|
35678
|
+
process.stdout.write(`
|
|
35679
|
+
${import_picocolors5.default.bold("PAYPHONE")} ${import_picocolors5.default.dim("no plan, no number: one payment, one call")}
|
|
35680
|
+
|
|
35681
|
+
`);
|
|
35682
|
+
const ladder = windows.map((w) => `${w.minutes} min ${usd2(w.priceUsd)}`).join(" ");
|
|
35683
|
+
process.stdout.write(` ${import_picocolors5.default.dim(ladder)}
|
|
35684
|
+
`);
|
|
35685
|
+
}
|
|
35686
|
+
const nets = [...new Set((plans[0]?.byNetwork ?? []).map((n) => n.network))];
|
|
35687
|
+
if (nets.length) process.stdout.write(`
|
|
35688
|
+
${import_picocolors5.default.dim(`USDC on ${nets.join(", ")}`)}
|
|
35689
|
+
|
|
35690
|
+
`);
|
|
35691
|
+
else process.stdout.write("\n");
|
|
35692
|
+
}
|
|
35693
|
+
async function phoneCall() {
|
|
35694
|
+
process.stdout.write(
|
|
35695
|
+
`
|
|
35696
|
+
A call signs an x402 payment, and this CLI has no signer yet.
|
|
35697
|
+
Call from the wallet, one biometric: ${import_picocolors5.default.cyan(`${SITE3}/phone`)}
|
|
35698
|
+
Prices from here: ${import_picocolors5.default.dim("agentgates phone pricing")}
|
|
35699
|
+
|
|
35700
|
+
`
|
|
35701
|
+
);
|
|
35702
|
+
}
|
|
35703
|
+
|
|
35611
35704
|
// src/commands/onboard.ts
|
|
35612
35705
|
var WORDMARK = [
|
|
35613
35706
|
" _ _",
|
|
@@ -35616,7 +35709,7 @@ var WORDMARK = [
|
|
|
35616
35709
|
" \\__,_\\__, \\___|_||_\\__\\__, \\__,_|\\__\\___/__/",
|
|
35617
35710
|
" |___/ |___/"
|
|
35618
35711
|
].join("\n");
|
|
35619
|
-
var TAGLINE = "Confidential virtual machines and
|
|
35712
|
+
var TAGLINE = "Confidential virtual machines, inference and phone numbers, paid per use in USDC.";
|
|
35620
35713
|
var { version: LOCAL_VERSION } = require_package();
|
|
35621
35714
|
function olderThan(a, b) {
|
|
35622
35715
|
const pa = a.split(".").map(Number);
|
|
@@ -35638,7 +35731,7 @@ async function staleLine() {
|
|
|
35638
35731
|
if (!res.ok) return null;
|
|
35639
35732
|
const { version: latest } = await res.json();
|
|
35640
35733
|
if (!latest || !olderThan(LOCAL_VERSION, latest)) return null;
|
|
35641
|
-
return ` ${
|
|
35734
|
+
return ` ${import_picocolors6.default.yellow("\u2191")} ${latest} is out, this copy is ${LOCAL_VERSION} \xB7 curl -fsSL ${CREATORS_ORIGIN}/api/cli/install | sh
|
|
35642
35735
|
|
|
35643
35736
|
`;
|
|
35644
35737
|
} catch {
|
|
@@ -35653,9 +35746,9 @@ function makePut(w) {
|
|
|
35653
35746
|
}
|
|
35654
35747
|
function banner() {
|
|
35655
35748
|
const w = water();
|
|
35656
|
-
if (!w) process.stdout.write("\n" +
|
|
35749
|
+
if (!w) process.stdout.write("\n" + import_picocolors6.default.cyan(WORDMARK) + "\n\n");
|
|
35657
35750
|
const put = makePut(w);
|
|
35658
|
-
put(` ${
|
|
35751
|
+
put(` ${import_picocolors6.default.dim(TAGLINE)}
|
|
35659
35752
|
|
|
35660
35753
|
`);
|
|
35661
35754
|
return { w, put };
|
|
@@ -35663,49 +35756,58 @@ function banner() {
|
|
|
35663
35756
|
var MENU = {
|
|
35664
35757
|
compute: { label: "see virtual machine pricing" },
|
|
35665
35758
|
models: { label: "see inference pricing" },
|
|
35759
|
+
phone: { label: "see phone pricing" },
|
|
35666
35760
|
docs: { label: "read the docs" },
|
|
35667
35761
|
poke: { label: "nothing, I'll poke around" },
|
|
35668
35762
|
wallet: { label: "pair my wallet", hint: "(members only)" }
|
|
35669
35763
|
};
|
|
35764
|
+
var LANES = {
|
|
35765
|
+
compute: { key: "compute", name: "virtual machines", docs: "/api/compute/docs" },
|
|
35766
|
+
inference: { key: "models", name: "inference", docs: "/api/inference/docs" },
|
|
35767
|
+
phone: { key: "phone", name: "phone", docs: "/api/identity/docs" }
|
|
35768
|
+
};
|
|
35769
|
+
var LANE_ORDER = ["compute", "inference", "phone"];
|
|
35770
|
+
function leadLane(lane) {
|
|
35771
|
+
return lane === "inference" || lane === "phone" ? lane : "compute";
|
|
35772
|
+
}
|
|
35773
|
+
function lanesLedBy(lane) {
|
|
35774
|
+
const lead = leadLane(lane);
|
|
35775
|
+
return [lead, ...LANE_ORDER.filter((l) => l !== lead)];
|
|
35776
|
+
}
|
|
35670
35777
|
function menuOrder(lane) {
|
|
35671
|
-
const browse = lane
|
|
35778
|
+
const browse = lanesLedBy(lane).map((l) => LANES[l].key);
|
|
35672
35779
|
return [...browse, "docs", "poke", "wallet"];
|
|
35673
35780
|
}
|
|
35674
35781
|
function printMenu(put, order, first) {
|
|
35675
|
-
put(` ${
|
|
35782
|
+
put(` ${import_picocolors6.default.bold(first ? "choose how to start:" : "what next:")}
|
|
35676
35783
|
`);
|
|
35677
35784
|
order.forEach((k, i) => {
|
|
35678
35785
|
const item = MENU[k];
|
|
35679
|
-
put(` ${
|
|
35786
|
+
put(` ${import_picocolors6.default.cyan(`${i + 1}.`)} ${item.label}${item.hint ? ` ${import_picocolors6.default.dim(item.hint)}` : ""}
|
|
35680
35787
|
`);
|
|
35681
35788
|
});
|
|
35682
35789
|
}
|
|
35683
35790
|
async function printDocs(put, lane) {
|
|
35684
|
-
const lead = lane
|
|
35685
|
-
const
|
|
35686
|
-
const name = (l) => l === "compute" ? "virtual machines" : "inference";
|
|
35791
|
+
const [lead, ...others] = lanesLedBy(lane);
|
|
35792
|
+
const url = (l) => `${CREATORS_ORIGIN}${LANES[l].docs}`;
|
|
35687
35793
|
try {
|
|
35688
|
-
const res = await fetch(
|
|
35689
|
-
headers: { accept: "text/markdown, text/plain" }
|
|
35690
|
-
});
|
|
35794
|
+
const res = await fetch(url(lead), { headers: { accept: "text/markdown, text/plain" } });
|
|
35691
35795
|
if (!res.ok) throw new Error(String(res.status));
|
|
35692
35796
|
const md = (await res.text()).replace(/\s+$/, "");
|
|
35693
35797
|
put(`
|
|
35694
|
-
${
|
|
35798
|
+
${import_picocolors6.default.bold(`THE ${LANES[lead].name.toUpperCase()} CONTRACT`)} ${import_picocolors6.default.dim(url(lead))}
|
|
35695
35799
|
|
|
35696
35800
|
`);
|
|
35697
35801
|
put(md + "\n\n");
|
|
35698
|
-
put(` ${
|
|
35699
|
-
|
|
35802
|
+
for (const other of others) put(` ${import_picocolors6.default.dim(`the ${LANES[other].name} contract:`)} ${url(other)}
|
|
35700
35803
|
`);
|
|
35804
|
+
put("\n");
|
|
35701
35805
|
} catch {
|
|
35702
|
-
put(` ${
|
|
35703
|
-
`);
|
|
35704
|
-
put(` ${import_picocolors5.default.cyan("virtual machines")} ${CREATORS_ORIGIN}/api/compute/docs
|
|
35806
|
+
put(` ${import_picocolors6.default.red("\u2715")} could not fetch the contract; the URLs:
|
|
35705
35807
|
`);
|
|
35706
|
-
put(` ${
|
|
35707
|
-
|
|
35808
|
+
for (const l of LANE_ORDER) put(` ${import_picocolors6.default.cyan(LANES[l].name.padEnd(16))} ${url(l)}
|
|
35708
35809
|
`);
|
|
35810
|
+
put("\n");
|
|
35709
35811
|
}
|
|
35710
35812
|
}
|
|
35711
35813
|
async function onboard(opts = {}) {
|
|
@@ -35713,7 +35815,7 @@ async function onboard(opts = {}) {
|
|
|
35713
35815
|
const { w, put } = banner();
|
|
35714
35816
|
const existing = await loadProfile(profileName).catch(() => null);
|
|
35715
35817
|
if (existing) {
|
|
35716
|
-
put(` ${
|
|
35818
|
+
put(` ${import_picocolors6.default.green("\u2713")} already paired as ${import_picocolors6.default.bold(existing.walletAddress ?? existing.userId)}
|
|
35717
35819
|
|
|
35718
35820
|
`);
|
|
35719
35821
|
}
|
|
@@ -35721,19 +35823,23 @@ async function onboard(opts = {}) {
|
|
|
35721
35823
|
put(` No terminal attached, so no menu. The machine door:
|
|
35722
35824
|
|
|
35723
35825
|
`);
|
|
35724
|
-
put(` agentgates compute plans --json ${
|
|
35826
|
+
put(` agentgates compute plans --json ${import_picocolors6.default.dim("\xB7 virtual machine pricing, JSON")}
|
|
35827
|
+
`);
|
|
35828
|
+
put(` agentgates inference models --json ${import_picocolors6.default.dim("\xB7 model pricing, JSON; --tier --tag --org --search filter it")}
|
|
35829
|
+
`);
|
|
35830
|
+
put(` agentgates phone pricing --json ${import_picocolors6.default.dim("\xB7 number plans, usage and payphone windows, JSON")}
|
|
35725
35831
|
`);
|
|
35726
|
-
put(`
|
|
35832
|
+
put(` ${CREATORS_ORIGIN}/api/compute/docs ${import_picocolors6.default.dim("\xB7 the buy/read/renew/destroy contract")}
|
|
35727
35833
|
`);
|
|
35728
|
-
put(` ${CREATORS_ORIGIN}/api/
|
|
35834
|
+
put(` ${CREATORS_ORIGIN}/api/inference/docs ${import_picocolors6.default.dim("\xB7 the chat contract, x402 or Bearer")}
|
|
35729
35835
|
`);
|
|
35730
|
-
put(` ${CREATORS_ORIGIN}/api/
|
|
35836
|
+
put(` ${CREATORS_ORIGIN}/api/identity/docs ${import_picocolors6.default.dim("\xB7 the phone contract: plans, numbers, the payphone")}
|
|
35731
35837
|
`);
|
|
35732
|
-
put(` ${CREATORS_ORIGIN}/llms.txt ${
|
|
35838
|
+
put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors6.default.dim("\xB7 the whole surface")}
|
|
35733
35839
|
|
|
35734
35840
|
`);
|
|
35735
35841
|
if (!existing) {
|
|
35736
|
-
put(` Pairing a wallet needs a human at a browser: ${
|
|
35842
|
+
put(` Pairing a wallet needs a human at a browser: ${import_picocolors6.default.bold("agentgates onboard")} in a real terminal.
|
|
35737
35843
|
|
|
35738
35844
|
`);
|
|
35739
35845
|
}
|
|
@@ -35754,7 +35860,7 @@ async function onboard(opts = {}) {
|
|
|
35754
35860
|
const fallback = first ? "1" : exitDefault;
|
|
35755
35861
|
let choice;
|
|
35756
35862
|
try {
|
|
35757
|
-
choice = (await rl.question(` ${
|
|
35863
|
+
choice = (await rl.question(` ${import_picocolors6.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
|
|
35758
35864
|
} catch {
|
|
35759
35865
|
if (first) w?.stop();
|
|
35760
35866
|
process.stdout.write("\n");
|
|
@@ -35778,7 +35884,7 @@ async function onboard(opts = {}) {
|
|
|
35778
35884
|
await runLoginFlow({ profile: profileName, jsonMode: false, ttyHeader: "Pairing this terminal with your wallet\u2026" });
|
|
35779
35885
|
process.stdout.write("\n");
|
|
35780
35886
|
} catch {
|
|
35781
|
-
plain(` ${
|
|
35887
|
+
plain(` ${import_picocolors6.default.red("\u2715")} pairing didn't complete
|
|
35782
35888
|
|
|
35783
35889
|
`);
|
|
35784
35890
|
}
|
|
@@ -35787,7 +35893,7 @@ async function onboard(opts = {}) {
|
|
|
35787
35893
|
try {
|
|
35788
35894
|
await computePlans({});
|
|
35789
35895
|
} catch {
|
|
35790
|
-
plain(` ${
|
|
35896
|
+
plain(` ${import_picocolors6.default.red("\u2715")} could not read the compute catalog
|
|
35791
35897
|
|
|
35792
35898
|
`);
|
|
35793
35899
|
}
|
|
@@ -35796,7 +35902,16 @@ async function onboard(opts = {}) {
|
|
|
35796
35902
|
try {
|
|
35797
35903
|
await inferenceModels({});
|
|
35798
35904
|
} catch {
|
|
35799
|
-
plain(` ${
|
|
35905
|
+
plain(` ${import_picocolors6.default.red("\u2715")} could not read the model catalog
|
|
35906
|
+
|
|
35907
|
+
`);
|
|
35908
|
+
}
|
|
35909
|
+
break;
|
|
35910
|
+
case "phone":
|
|
35911
|
+
try {
|
|
35912
|
+
await phonePricing({});
|
|
35913
|
+
} catch {
|
|
35914
|
+
plain(` ${import_picocolors6.default.red("\u2715")} could not read the phone catalog
|
|
35800
35915
|
|
|
35801
35916
|
`);
|
|
35802
35917
|
}
|
|
@@ -35812,26 +35927,28 @@ async function onboard(opts = {}) {
|
|
|
35812
35927
|
}
|
|
35813
35928
|
}
|
|
35814
35929
|
function printNext(put) {
|
|
35815
|
-
put(` ${
|
|
35930
|
+
put(` ${import_picocolors6.default.dim("agentgates compute plans")} ${import_picocolors6.default.dim("\xB7 virtual machines by the hour")}
|
|
35816
35931
|
`);
|
|
35817
|
-
put(` ${
|
|
35932
|
+
put(` ${import_picocolors6.default.dim("agentgates inference models")} ${import_picocolors6.default.dim("\xB7 models by the token")}
|
|
35818
35933
|
`);
|
|
35819
|
-
put(` ${
|
|
35934
|
+
put(` ${import_picocolors6.default.dim("agentgates phone pricing")} ${import_picocolors6.default.dim("\xB7 numbers by the month, calls by the minute")}
|
|
35935
|
+
`);
|
|
35936
|
+
put(` ${import_picocolors6.default.dim("agentgates --help")} ${import_picocolors6.default.dim("\xB7 everything else")}
|
|
35820
35937
|
|
|
35821
35938
|
`);
|
|
35822
35939
|
}
|
|
35823
35940
|
|
|
35824
35941
|
// src/commands/logout.ts
|
|
35825
|
-
var
|
|
35942
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
35826
35943
|
async function logout(opts) {
|
|
35827
35944
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35828
35945
|
const resolved = await resolveProfile(requested);
|
|
35829
35946
|
if (!resolved) {
|
|
35830
|
-
process.stdout.write(
|
|
35947
|
+
process.stdout.write(import_picocolors7.default.dim("Not logged in \u2014 nothing to log out.\n"));
|
|
35831
35948
|
return;
|
|
35832
35949
|
}
|
|
35833
35950
|
if (resolved.autoSelected) {
|
|
35834
|
-
process.stderr.write(
|
|
35951
|
+
process.stderr.write(import_picocolors7.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35835
35952
|
`));
|
|
35836
35953
|
}
|
|
35837
35954
|
const { profile, name: profileName } = resolved;
|
|
@@ -35856,15 +35973,15 @@ async function logout(opts) {
|
|
|
35856
35973
|
const removed = await deleteProfile(profileName);
|
|
35857
35974
|
if (removed) {
|
|
35858
35975
|
process.stdout.write(
|
|
35859
|
-
|
|
35976
|
+
import_picocolors7.default.green(`\u2713 Logged out of profile ${import_picocolors7.default.bold(profileName)}.
|
|
35860
35977
|
`)
|
|
35861
35978
|
);
|
|
35862
35979
|
}
|
|
35863
35980
|
if (serverError) {
|
|
35864
35981
|
process.stderr.write(
|
|
35865
|
-
|
|
35982
|
+
import_picocolors7.default.yellow(
|
|
35866
35983
|
`\u26A0 Couldn't revoke server-side: ${serverError}
|
|
35867
|
-
The local bearer is wiped. If the server still has it, revoke from ${
|
|
35984
|
+
The local bearer is wiped. If the server still has it, revoke from ${import_picocolors7.default.bold("agentgates.ai/settings/pairings")}.
|
|
35868
35985
|
`
|
|
35869
35986
|
)
|
|
35870
35987
|
);
|
|
@@ -35872,16 +35989,16 @@ async function logout(opts) {
|
|
|
35872
35989
|
}
|
|
35873
35990
|
|
|
35874
35991
|
// src/commands/whoami.ts
|
|
35875
|
-
var
|
|
35992
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
35876
35993
|
async function whoami(opts) {
|
|
35877
35994
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35878
35995
|
const resolved = await resolveProfile(requested);
|
|
35879
35996
|
if (!resolved) {
|
|
35880
|
-
process.stderr.write(
|
|
35997
|
+
process.stderr.write(import_picocolors8.default.red("Not logged in. Run agentgates login first.\n"));
|
|
35881
35998
|
process.exit(2);
|
|
35882
35999
|
}
|
|
35883
36000
|
if (resolved.autoSelected) {
|
|
35884
|
-
process.stderr.write(
|
|
36001
|
+
process.stderr.write(import_picocolors8.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35885
36002
|
`));
|
|
35886
36003
|
}
|
|
35887
36004
|
const { profile, name: profileName } = resolved;
|
|
@@ -35890,7 +36007,7 @@ async function whoami(opts) {
|
|
|
35890
36007
|
profile,
|
|
35891
36008
|
profileName,
|
|
35892
36009
|
jsonMode,
|
|
35893
|
-
ttyHeader:
|
|
36010
|
+
ttyHeader: import_picocolors8.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
35894
36011
|
fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
|
|
35895
36012
|
});
|
|
35896
36013
|
if (outcome.kind === "auth_failed") {
|
|
@@ -35900,14 +36017,14 @@ async function whoami(opts) {
|
|
|
35900
36017
|
);
|
|
35901
36018
|
process.exit(1);
|
|
35902
36019
|
}
|
|
35903
|
-
process.stderr.write(
|
|
36020
|
+
process.stderr.write(import_picocolors8.default.red(`\u2715 ${outcome.reason}.
|
|
35904
36021
|
`));
|
|
35905
36022
|
process.exit(1);
|
|
35906
36023
|
}
|
|
35907
36024
|
if (outcome.kind === "error") {
|
|
35908
36025
|
const err = outcome.error;
|
|
35909
36026
|
if (err instanceof ApiError) {
|
|
35910
|
-
process.stderr.write(
|
|
36027
|
+
process.stderr.write(import_picocolors8.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
35911
36028
|
`));
|
|
35912
36029
|
process.exit(1);
|
|
35913
36030
|
}
|
|
@@ -35928,7 +36045,7 @@ async function whoami(opts) {
|
|
|
35928
36045
|
process.stdout.write(`Solana ${me.solanaAddress}
|
|
35929
36046
|
`);
|
|
35930
36047
|
}
|
|
35931
|
-
process.stdout.write(`Scopes ${me.scopes.join(", ") ||
|
|
36048
|
+
process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors8.default.dim("(none)")}
|
|
35932
36049
|
`);
|
|
35933
36050
|
const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
|
|
35934
36051
|
const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
|
|
@@ -35945,7 +36062,7 @@ async function whoami(opts) {
|
|
|
35945
36062
|
`
|
|
35946
36063
|
);
|
|
35947
36064
|
process.stdout.write(
|
|
35948
|
-
`Profile ${profileName === DEFAULT_PROFILE ?
|
|
36065
|
+
`Profile ${profileName === DEFAULT_PROFILE ? import_picocolors8.default.dim("(default)") : profileName}
|
|
35949
36066
|
`
|
|
35950
36067
|
);
|
|
35951
36068
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -35959,7 +36076,7 @@ function formatDate(iso) {
|
|
|
35959
36076
|
}
|
|
35960
36077
|
|
|
35961
36078
|
// src/commands/send.ts
|
|
35962
|
-
var
|
|
36079
|
+
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
35963
36080
|
|
|
35964
36081
|
// src/lib/status.ts
|
|
35965
36082
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -36109,11 +36226,11 @@ async function send(amount, asset, opts) {
|
|
|
36109
36226
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36110
36227
|
const resolved = await resolveProfile(requested);
|
|
36111
36228
|
if (!resolved) {
|
|
36112
|
-
process.stderr.write(
|
|
36229
|
+
process.stderr.write(import_picocolors9.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36113
36230
|
process.exit(2);
|
|
36114
36231
|
}
|
|
36115
36232
|
if (resolved.autoSelected) {
|
|
36116
|
-
process.stderr.write(
|
|
36233
|
+
process.stderr.write(import_picocolors9.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36117
36234
|
`));
|
|
36118
36235
|
}
|
|
36119
36236
|
const { profile, name: profileName } = resolved;
|
|
@@ -36122,7 +36239,7 @@ async function send(amount, asset, opts) {
|
|
|
36122
36239
|
const amountNumber = Number(amount);
|
|
36123
36240
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
36124
36241
|
process.stderr.write(
|
|
36125
|
-
|
|
36242
|
+
import_picocolors9.default.red(`\u2715 amount must be a positive number (got ${import_picocolors9.default.bold(amount)}).
|
|
36126
36243
|
`)
|
|
36127
36244
|
);
|
|
36128
36245
|
process.exit(2);
|
|
@@ -36130,23 +36247,23 @@ async function send(amount, asset, opts) {
|
|
|
36130
36247
|
const assetNormalized = asset.toLowerCase();
|
|
36131
36248
|
if (assetNormalized !== "native" && assetNormalized !== "usdc") {
|
|
36132
36249
|
process.stderr.write(
|
|
36133
|
-
|
|
36134
|
-
`\u2715 asset must be ${
|
|
36250
|
+
import_picocolors9.default.red(
|
|
36251
|
+
`\u2715 asset must be ${import_picocolors9.default.bold("native")} or ${import_picocolors9.default.bold("usdc")} (got ${import_picocolors9.default.bold(asset)}).
|
|
36135
36252
|
`
|
|
36136
36253
|
)
|
|
36137
36254
|
);
|
|
36138
36255
|
process.exit(2);
|
|
36139
36256
|
}
|
|
36140
36257
|
if (!opts.to || opts.to.trim() === "") {
|
|
36141
|
-
process.stderr.write(
|
|
36258
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 --to <address> is required.
|
|
36142
36259
|
`));
|
|
36143
36260
|
process.exit(2);
|
|
36144
36261
|
}
|
|
36145
36262
|
if (isSolanaChainAlias(opts.chain)) {
|
|
36146
36263
|
if (EVM_ADDRESS_RE.test(opts.to)) {
|
|
36147
36264
|
process.stderr.write(
|
|
36148
|
-
|
|
36149
|
-
`\u2715 --to looks like an EVM address (0x-hex), but --chain is ${
|
|
36265
|
+
import_picocolors9.default.red(
|
|
36266
|
+
`\u2715 --to looks like an EVM address (0x-hex), but --chain is ${import_picocolors9.default.bold("solana")}. Pass a base58 Solana pubkey, or pick an EVM chain.
|
|
36150
36267
|
`
|
|
36151
36268
|
)
|
|
36152
36269
|
);
|
|
@@ -36154,10 +36271,10 @@ async function send(amount, asset, opts) {
|
|
|
36154
36271
|
}
|
|
36155
36272
|
if (!SOLANA_ADDRESS_RE.test(opts.to)) {
|
|
36156
36273
|
process.stderr.write(
|
|
36157
|
-
|
|
36158
|
-
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${
|
|
36274
|
+
import_picocolors9.default.red(
|
|
36275
|
+
`\u2715 --to must be a base58 Solana pubkey (32\u201344 chars, base58 alphabet) for --chain solana (got ${import_picocolors9.default.bold(opts.to)}).
|
|
36159
36276
|
`
|
|
36160
|
-
) +
|
|
36277
|
+
) + import_picocolors9.default.dim(
|
|
36161
36278
|
` SNS resolution is deferred to a future server-side change;
|
|
36162
36279
|
for now Solana sends require the literal pubkey.
|
|
36163
36280
|
`
|
|
@@ -36168,8 +36285,8 @@ async function send(amount, asset, opts) {
|
|
|
36168
36285
|
}
|
|
36169
36286
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
36170
36287
|
process.stderr.write(
|
|
36171
|
-
|
|
36172
|
-
`) +
|
|
36288
|
+
import_picocolors9.default.red(`\u2715 --user-stated <text> is required.
|
|
36289
|
+
`) + import_picocolors9.default.dim(
|
|
36173
36290
|
` This is the trust-gap defense: pass the verbatim user request so
|
|
36174
36291
|
the approval modal can cross-check what the agent thinks the user
|
|
36175
36292
|
asked for vs. the actual decoded transaction.
|
|
@@ -36187,7 +36304,7 @@ async function send(amount, asset, opts) {
|
|
|
36187
36304
|
const n = Number(opts.maxUsd);
|
|
36188
36305
|
if (!Number.isFinite(n) || n <= 0) {
|
|
36189
36306
|
process.stderr.write(
|
|
36190
|
-
|
|
36307
|
+
import_picocolors9.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
|
|
36191
36308
|
`)
|
|
36192
36309
|
);
|
|
36193
36310
|
process.exit(2);
|
|
@@ -36229,7 +36346,7 @@ async function send(amount, asset, opts) {
|
|
|
36229
36346
|
profile: profileName,
|
|
36230
36347
|
jsonMode,
|
|
36231
36348
|
origin: activeProfile.mcpOrigin,
|
|
36232
|
-
ttyHeader:
|
|
36349
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
36233
36350
|
});
|
|
36234
36351
|
} catch (reloginErr) {
|
|
36235
36352
|
if (jsonMode) {
|
|
@@ -36241,7 +36358,7 @@ async function send(amount, asset, opts) {
|
|
|
36241
36358
|
process.exit(1);
|
|
36242
36359
|
}
|
|
36243
36360
|
process.stderr.write(
|
|
36244
|
-
|
|
36361
|
+
import_picocolors9.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36245
36362
|
`)
|
|
36246
36363
|
);
|
|
36247
36364
|
process.exit(1);
|
|
@@ -36265,7 +36382,7 @@ async function send(amount, asset, opts) {
|
|
|
36265
36382
|
process.exit(1);
|
|
36266
36383
|
}
|
|
36267
36384
|
process.stderr.write(
|
|
36268
|
-
|
|
36385
|
+
import_picocolors9.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
36269
36386
|
`)
|
|
36270
36387
|
);
|
|
36271
36388
|
process.exit(1);
|
|
@@ -36282,7 +36399,7 @@ async function send(amount, asset, opts) {
|
|
|
36282
36399
|
});
|
|
36283
36400
|
process.exit(1);
|
|
36284
36401
|
}
|
|
36285
|
-
process.stderr.write(
|
|
36402
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36286
36403
|
`));
|
|
36287
36404
|
process.exit(1);
|
|
36288
36405
|
} else {
|
|
@@ -36308,17 +36425,17 @@ async function send(amount, asset, opts) {
|
|
|
36308
36425
|
if (proposed.detail) {
|
|
36309
36426
|
const d = proposed.detail;
|
|
36310
36427
|
process.stderr.write(
|
|
36311
|
-
|
|
36428
|
+
import_picocolors9.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
|
|
36312
36429
|
`
|
|
36313
36430
|
);
|
|
36314
36431
|
} else {
|
|
36315
|
-
process.stderr.write(
|
|
36432
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${proposed.reason}
|
|
36316
36433
|
`));
|
|
36317
36434
|
}
|
|
36318
36435
|
if (proposed.upgrade_url) {
|
|
36319
36436
|
process.stderr.write(
|
|
36320
36437
|
` Open this to grant access, then re-run the command:
|
|
36321
|
-
${
|
|
36438
|
+
${import_picocolors9.default.cyan(proposed.upgrade_url)}
|
|
36322
36439
|
`
|
|
36323
36440
|
);
|
|
36324
36441
|
}
|
|
@@ -36328,21 +36445,21 @@ async function send(amount, asset, opts) {
|
|
|
36328
36445
|
const a = proposed.recommended_actions[i];
|
|
36329
36446
|
process.stderr.write(` ${i + 1}. ${a.label}
|
|
36330
36447
|
`);
|
|
36331
|
-
if (a.reasoning) process.stderr.write(
|
|
36448
|
+
if (a.reasoning) process.stderr.write(import_picocolors9.default.dim(` ${a.reasoning}
|
|
36332
36449
|
`));
|
|
36333
36450
|
if (a.action_intent && a.action_intent.external_url) {
|
|
36334
36451
|
process.stderr.write(
|
|
36335
|
-
` ${
|
|
36452
|
+
` ${import_picocolors9.default.cyan(a.action_intent.external_url)}
|
|
36336
36453
|
`
|
|
36337
36454
|
);
|
|
36338
36455
|
}
|
|
36339
36456
|
}
|
|
36340
36457
|
}
|
|
36341
36458
|
if (proposed.suggestions && proposed.suggestions.length > 0) {
|
|
36342
|
-
process.stderr.write(
|
|
36459
|
+
process.stderr.write(import_picocolors9.default.dim("\n Other ways to fund:\n"));
|
|
36343
36460
|
for (const s of proposed.suggestions) {
|
|
36344
36461
|
if (s.kind === "ask_user") continue;
|
|
36345
|
-
process.stderr.write(
|
|
36462
|
+
process.stderr.write(import_picocolors9.default.dim(` \u2022 ${s.label}
|
|
36346
36463
|
`));
|
|
36347
36464
|
}
|
|
36348
36465
|
}
|
|
@@ -36369,8 +36486,8 @@ async function send(amount, asset, opts) {
|
|
|
36369
36486
|
} else {
|
|
36370
36487
|
process.stdout.write(
|
|
36371
36488
|
`
|
|
36372
|
-
${
|
|
36373
|
-
${
|
|
36489
|
+
${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
36490
|
+
${import_picocolors9.default.cyan(proposed.approval_url)}
|
|
36374
36491
|
|
|
36375
36492
|
`
|
|
36376
36493
|
);
|
|
@@ -36389,7 +36506,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36389
36506
|
if (jsonMode) {
|
|
36390
36507
|
emitNdjson({ status: s.status, intent_id: s.approval_id });
|
|
36391
36508
|
} else {
|
|
36392
|
-
process.stdout.write(` ${describeStatus(s.status)}${
|
|
36509
|
+
process.stdout.write(` ${describeStatus(s.status)}${import_picocolors9.default.dim("\u2026")}\r`);
|
|
36393
36510
|
}
|
|
36394
36511
|
}
|
|
36395
36512
|
});
|
|
@@ -36403,7 +36520,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36403
36520
|
profile: profileName,
|
|
36404
36521
|
jsonMode,
|
|
36405
36522
|
origin: activeProfile.mcpOrigin,
|
|
36406
|
-
ttyHeader:
|
|
36523
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
|
|
36407
36524
|
});
|
|
36408
36525
|
} catch (reloginErr) {
|
|
36409
36526
|
if (jsonMode) {
|
|
@@ -36416,7 +36533,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36416
36533
|
process.exit(1);
|
|
36417
36534
|
}
|
|
36418
36535
|
process.stderr.write(
|
|
36419
|
-
"\n" +
|
|
36536
|
+
"\n" + import_picocolors9.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36420
36537
|
`)
|
|
36421
36538
|
);
|
|
36422
36539
|
process.exit(1);
|
|
@@ -36434,7 +36551,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36434
36551
|
process.exit(1);
|
|
36435
36552
|
}
|
|
36436
36553
|
process.stderr.write(
|
|
36437
|
-
"\n" +
|
|
36554
|
+
"\n" + import_picocolors9.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
36438
36555
|
`)
|
|
36439
36556
|
);
|
|
36440
36557
|
process.exit(1);
|
|
@@ -36450,7 +36567,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36450
36567
|
process.exit(1);
|
|
36451
36568
|
}
|
|
36452
36569
|
process.stderr.write(
|
|
36453
|
-
"\n" +
|
|
36570
|
+
"\n" + import_picocolors9.default.red(`\u2715 Status poll failed: ${err.message}
|
|
36454
36571
|
`)
|
|
36455
36572
|
);
|
|
36456
36573
|
process.exit(1);
|
|
@@ -36470,19 +36587,19 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36470
36587
|
}
|
|
36471
36588
|
process.stdout.write("\n");
|
|
36472
36589
|
if (final.status === "mined") {
|
|
36473
|
-
process.stdout.write(
|
|
36590
|
+
process.stdout.write(import_picocolors9.default.green("\u2713 Mined.") + "\n");
|
|
36474
36591
|
if (final.tx_hash) {
|
|
36475
36592
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
36476
36593
|
`);
|
|
36477
36594
|
}
|
|
36478
36595
|
if (explorer) {
|
|
36479
|
-
process.stdout.write(` Explorer ${
|
|
36596
|
+
process.stdout.write(` Explorer ${import_picocolors9.default.cyan(explorer)}
|
|
36480
36597
|
`);
|
|
36481
36598
|
}
|
|
36482
36599
|
process.exit(0);
|
|
36483
36600
|
}
|
|
36484
36601
|
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}`;
|
|
36485
|
-
process.stderr.write(
|
|
36602
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${label}.
|
|
36486
36603
|
`));
|
|
36487
36604
|
process.exit(1);
|
|
36488
36605
|
}
|
|
@@ -36510,7 +36627,7 @@ function describeStatus(s) {
|
|
|
36510
36627
|
}
|
|
36511
36628
|
|
|
36512
36629
|
// src/commands/status.ts
|
|
36513
|
-
var
|
|
36630
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
36514
36631
|
var WATCH_GIVEUP_MS = 10 * 6e4;
|
|
36515
36632
|
function explorerUrl2(chainId, hash) {
|
|
36516
36633
|
switch (chainId) {
|
|
@@ -36528,17 +36645,17 @@ function explorerUrl2(chainId, hash) {
|
|
|
36528
36645
|
}
|
|
36529
36646
|
async function status(intentId, opts) {
|
|
36530
36647
|
if (!intentId || intentId.trim() === "") {
|
|
36531
|
-
process.stderr.write(
|
|
36648
|
+
process.stderr.write(import_picocolors10.default.red("\u2715 Missing intent id.\n"));
|
|
36532
36649
|
process.exit(2);
|
|
36533
36650
|
}
|
|
36534
36651
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36535
36652
|
const resolved = await resolveProfile(requested);
|
|
36536
36653
|
if (!resolved) {
|
|
36537
|
-
process.stderr.write(
|
|
36654
|
+
process.stderr.write(import_picocolors10.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36538
36655
|
process.exit(2);
|
|
36539
36656
|
}
|
|
36540
36657
|
if (resolved.autoSelected) {
|
|
36541
|
-
process.stderr.write(
|
|
36658
|
+
process.stderr.write(import_picocolors10.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36542
36659
|
`));
|
|
36543
36660
|
}
|
|
36544
36661
|
const { profile, name: profileName } = resolved;
|
|
@@ -36547,7 +36664,7 @@ async function status(intentId, opts) {
|
|
|
36547
36664
|
profile,
|
|
36548
36665
|
profileName,
|
|
36549
36666
|
jsonMode,
|
|
36550
|
-
ttyHeader:
|
|
36667
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36551
36668
|
fn: (bearer, origin) => fetchStatus({ intentId, bearer, origin })
|
|
36552
36669
|
});
|
|
36553
36670
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36557,7 +36674,7 @@ async function status(intentId, opts) {
|
|
|
36557
36674
|
);
|
|
36558
36675
|
process.exit(1);
|
|
36559
36676
|
}
|
|
36560
|
-
process.stderr.write(
|
|
36677
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${outcome.reason}.
|
|
36561
36678
|
`));
|
|
36562
36679
|
process.exit(1);
|
|
36563
36680
|
}
|
|
@@ -36565,11 +36682,11 @@ async function status(intentId, opts) {
|
|
|
36565
36682
|
const err = outcome.error;
|
|
36566
36683
|
if (err instanceof ApiError) {
|
|
36567
36684
|
if (err.status === 404) {
|
|
36568
|
-
process.stderr.write(
|
|
36685
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 No intent with id ${intentId}.
|
|
36569
36686
|
`));
|
|
36570
36687
|
process.exit(1);
|
|
36571
36688
|
}
|
|
36572
|
-
process.stderr.write(
|
|
36689
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36573
36690
|
`));
|
|
36574
36691
|
process.exit(1);
|
|
36575
36692
|
}
|
|
@@ -36580,7 +36697,7 @@ async function status(intentId, opts) {
|
|
|
36580
36697
|
if (opts.watch && !isTerminalStatus(snap.status)) {
|
|
36581
36698
|
if (!jsonMode) {
|
|
36582
36699
|
printSnap(snap);
|
|
36583
|
-
process.stdout.write(
|
|
36700
|
+
process.stdout.write(import_picocolors10.default.dim("Watching\u2026\n"));
|
|
36584
36701
|
}
|
|
36585
36702
|
const runWatchPoll = (p) => streamStatusUntilTerminal({
|
|
36586
36703
|
intentId,
|
|
@@ -36591,7 +36708,7 @@ async function status(intentId, opts) {
|
|
|
36591
36708
|
giveUpMs: WATCH_GIVEUP_MS,
|
|
36592
36709
|
onTick: (s) => {
|
|
36593
36710
|
if (!jsonMode) {
|
|
36594
|
-
process.stdout.write(` ${
|
|
36711
|
+
process.stdout.write(` ${import_picocolors10.default.dim("\u2192")} ${s.status}
|
|
36595
36712
|
`);
|
|
36596
36713
|
}
|
|
36597
36714
|
}
|
|
@@ -36606,7 +36723,7 @@ async function status(intentId, opts) {
|
|
|
36606
36723
|
profile: profileName,
|
|
36607
36724
|
jsonMode,
|
|
36608
36725
|
origin: activeProfile.mcpOrigin,
|
|
36609
|
-
ttyHeader:
|
|
36726
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
|
|
36610
36727
|
});
|
|
36611
36728
|
} catch (reloginErr) {
|
|
36612
36729
|
if (jsonMode) {
|
|
@@ -36620,7 +36737,7 @@ async function status(intentId, opts) {
|
|
|
36620
36737
|
process.exit(1);
|
|
36621
36738
|
}
|
|
36622
36739
|
process.stderr.write(
|
|
36623
|
-
|
|
36740
|
+
import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36624
36741
|
`)
|
|
36625
36742
|
);
|
|
36626
36743
|
process.exit(1);
|
|
@@ -36628,12 +36745,12 @@ async function status(intentId, opts) {
|
|
|
36628
36745
|
try {
|
|
36629
36746
|
final = await runWatchPoll(activeProfile);
|
|
36630
36747
|
} catch (retryErr) {
|
|
36631
|
-
process.stderr.write(
|
|
36748
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${retryErr.message}
|
|
36632
36749
|
`));
|
|
36633
36750
|
process.exit(1);
|
|
36634
36751
|
}
|
|
36635
36752
|
} else {
|
|
36636
|
-
process.stderr.write(
|
|
36753
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message}
|
|
36637
36754
|
`));
|
|
36638
36755
|
process.exit(1);
|
|
36639
36756
|
}
|
|
@@ -36654,7 +36771,7 @@ async function status(intentId, opts) {
|
|
|
36654
36771
|
}
|
|
36655
36772
|
function printSnap(s) {
|
|
36656
36773
|
const explorer = s.tx_hash ? explorerUrl2(s.chain_id, s.tx_hash) : null;
|
|
36657
|
-
const colorFn = s.status === "mined" ?
|
|
36774
|
+
const colorFn = s.status === "mined" ? import_picocolors10.default.green : s.status === "rejected" || s.status === "expired" || s.status === "failed" ? import_picocolors10.default.red : import_picocolors10.default.cyan;
|
|
36658
36775
|
process.stdout.write(`Intent ${s.approval_id}
|
|
36659
36776
|
`);
|
|
36660
36777
|
process.stdout.write(`Status ${colorFn(s.status)}
|
|
@@ -36669,12 +36786,12 @@ function printSnap(s) {
|
|
|
36669
36786
|
process.stdout.write(`Tx ${s.tx_hash}
|
|
36670
36787
|
`);
|
|
36671
36788
|
if (explorer) {
|
|
36672
|
-
process.stdout.write(`Explorer ${
|
|
36789
|
+
process.stdout.write(`Explorer ${import_picocolors10.default.cyan(explorer)}
|
|
36673
36790
|
`);
|
|
36674
36791
|
}
|
|
36675
36792
|
}
|
|
36676
36793
|
if (!isTerminalStatus(s.status)) {
|
|
36677
|
-
process.stdout.write(`Approve ${
|
|
36794
|
+
process.stdout.write(`Approve ${import_picocolors10.default.cyan(s.approval_url)}
|
|
36678
36795
|
`);
|
|
36679
36796
|
}
|
|
36680
36797
|
process.stdout.write(`Created ${formatDate2(s.created_at)}
|
|
@@ -36691,7 +36808,7 @@ function formatDate2(iso) {
|
|
|
36691
36808
|
}
|
|
36692
36809
|
|
|
36693
36810
|
// src/commands/balance.ts
|
|
36694
|
-
var
|
|
36811
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
36695
36812
|
var CHAIN_ALIASES = {
|
|
36696
36813
|
"1": 1,
|
|
36697
36814
|
ethereum: 1,
|
|
@@ -36714,11 +36831,11 @@ async function balance(opts) {
|
|
|
36714
36831
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36715
36832
|
const resolved = await resolveProfile(requested);
|
|
36716
36833
|
if (!resolved) {
|
|
36717
|
-
process.stderr.write(
|
|
36834
|
+
process.stderr.write(import_picocolors11.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36718
36835
|
process.exit(2);
|
|
36719
36836
|
}
|
|
36720
36837
|
if (resolved.autoSelected) {
|
|
36721
|
-
process.stderr.write(
|
|
36838
|
+
process.stderr.write(import_picocolors11.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36722
36839
|
`));
|
|
36723
36840
|
}
|
|
36724
36841
|
const { profile, name: profileName } = resolved;
|
|
@@ -36728,8 +36845,8 @@ async function balance(opts) {
|
|
|
36728
36845
|
const id = CHAIN_ALIASES[key];
|
|
36729
36846
|
if (id === void 0) {
|
|
36730
36847
|
process.stderr.write(
|
|
36731
|
-
|
|
36732
|
-
`\u2715 Unknown chain ${
|
|
36848
|
+
import_picocolors11.default.red(
|
|
36849
|
+
`\u2715 Unknown chain ${import_picocolors11.default.bold(opts.chain)}. Supported: ${import_picocolors11.default.bold("1/ethereum")}, ${import_picocolors11.default.bold("137/polygon")}, ${import_picocolors11.default.bold("8453/base")}, ${import_picocolors11.default.bold("42161/arbitrum")}, ${import_picocolors11.default.bold("900/solana")}.
|
|
36733
36850
|
`
|
|
36734
36851
|
)
|
|
36735
36852
|
);
|
|
@@ -36742,7 +36859,7 @@ async function balance(opts) {
|
|
|
36742
36859
|
profile,
|
|
36743
36860
|
profileName,
|
|
36744
36861
|
jsonMode,
|
|
36745
|
-
ttyHeader:
|
|
36862
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36746
36863
|
fn: (bearer, origin) => apiFetch("/api/balances", { bearer, origin })
|
|
36747
36864
|
});
|
|
36748
36865
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36752,14 +36869,14 @@ async function balance(opts) {
|
|
|
36752
36869
|
);
|
|
36753
36870
|
process.exit(1);
|
|
36754
36871
|
}
|
|
36755
|
-
process.stderr.write(
|
|
36872
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${outcome.reason}.
|
|
36756
36873
|
`));
|
|
36757
36874
|
process.exit(1);
|
|
36758
36875
|
}
|
|
36759
36876
|
if (outcome.kind === "error") {
|
|
36760
36877
|
const err = outcome.error;
|
|
36761
36878
|
if (err instanceof ApiError) {
|
|
36762
|
-
process.stderr.write(
|
|
36879
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36763
36880
|
`));
|
|
36764
36881
|
process.exit(1);
|
|
36765
36882
|
}
|
|
@@ -36789,7 +36906,7 @@ async function balance(opts) {
|
|
|
36789
36906
|
}
|
|
36790
36907
|
if (filtered.length === 0) {
|
|
36791
36908
|
process.stdout.write(
|
|
36792
|
-
|
|
36909
|
+
import_picocolors11.default.dim(
|
|
36793
36910
|
chainFilter !== null ? `No balances on chain ${chainFilter}.
|
|
36794
36911
|
` : `No chain balances returned.
|
|
36795
36912
|
`
|
|
@@ -36801,7 +36918,7 @@ async function balance(opts) {
|
|
|
36801
36918
|
const errorLines = [];
|
|
36802
36919
|
for (const c of filtered) {
|
|
36803
36920
|
if (c.error) {
|
|
36804
|
-
errorLines.push(`${c.chainName} ${
|
|
36921
|
+
errorLines.push(`${c.chainName} ${import_picocolors11.default.red(`(read failed: ${c.error})`)}`);
|
|
36805
36922
|
continue;
|
|
36806
36923
|
}
|
|
36807
36924
|
if (c.native.balance > 0) {
|
|
@@ -36822,7 +36939,7 @@ async function balance(opts) {
|
|
|
36822
36939
|
}
|
|
36823
36940
|
}
|
|
36824
36941
|
if (rows.length === 0 && errorLines.length === 0) {
|
|
36825
|
-
process.stdout.write(
|
|
36942
|
+
process.stdout.write(import_picocolors11.default.dim(`All balances are zero.
|
|
36826
36943
|
`));
|
|
36827
36944
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
36828
36945
|
return;
|
|
@@ -36832,7 +36949,7 @@ async function balance(opts) {
|
|
|
36832
36949
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36833
36950
|
const colBalance = Math.max(7, ...rows.map((r) => r.balance.length));
|
|
36834
36951
|
const header = "Chain".padEnd(colChain) + " " + "Asset".padEnd(colAsset) + " " + "Balance".padStart(colBalance);
|
|
36835
|
-
process.stdout.write(
|
|
36952
|
+
process.stdout.write(import_picocolors11.default.dim(header) + "\n");
|
|
36836
36953
|
for (const r of rows) {
|
|
36837
36954
|
process.stdout.write(
|
|
36838
36955
|
r.chain.padEnd(colChain) + " " + r.asset.padEnd(colAsset) + " " + r.balance.padStart(colBalance) + "\n"
|
|
@@ -36845,7 +36962,7 @@ async function balance(opts) {
|
|
|
36845
36962
|
`);
|
|
36846
36963
|
}
|
|
36847
36964
|
if (res.fetched_at) {
|
|
36848
|
-
process.stdout.write("\n" +
|
|
36965
|
+
process.stdout.write("\n" + import_picocolors11.default.dim(`Fetched ${res.fetched_at}
|
|
36849
36966
|
`));
|
|
36850
36967
|
}
|
|
36851
36968
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36858,18 +36975,18 @@ function formatBalance(value, decimals) {
|
|
|
36858
36975
|
}
|
|
36859
36976
|
|
|
36860
36977
|
// src/commands/history.ts
|
|
36861
|
-
var
|
|
36978
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
36862
36979
|
var DEFAULT_LIMIT = 20;
|
|
36863
36980
|
var SERVER_MAX_LIMIT = 100;
|
|
36864
36981
|
async function history(opts) {
|
|
36865
36982
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36866
36983
|
const resolved = await resolveProfile(requested);
|
|
36867
36984
|
if (!resolved) {
|
|
36868
|
-
process.stderr.write(
|
|
36985
|
+
process.stderr.write(import_picocolors12.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36869
36986
|
process.exit(2);
|
|
36870
36987
|
}
|
|
36871
36988
|
if (resolved.autoSelected) {
|
|
36872
|
-
process.stderr.write(
|
|
36989
|
+
process.stderr.write(import_picocolors12.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36873
36990
|
`));
|
|
36874
36991
|
}
|
|
36875
36992
|
const { profile, name: profileName } = resolved;
|
|
@@ -36878,14 +36995,14 @@ async function history(opts) {
|
|
|
36878
36995
|
const n = Number(opts.limit);
|
|
36879
36996
|
if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
|
|
36880
36997
|
process.stderr.write(
|
|
36881
|
-
|
|
36998
|
+
import_picocolors12.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors12.default.bold(opts.limit)}).
|
|
36882
36999
|
`)
|
|
36883
37000
|
);
|
|
36884
37001
|
process.exit(2);
|
|
36885
37002
|
}
|
|
36886
37003
|
if (n > SERVER_MAX_LIMIT) {
|
|
36887
37004
|
process.stderr.write(
|
|
36888
|
-
|
|
37005
|
+
import_picocolors12.default.red(
|
|
36889
37006
|
`\u2715 --limit max is ${SERVER_MAX_LIMIT} (the server's wallet://history hard cap). Got ${n}.
|
|
36890
37007
|
`
|
|
36891
37008
|
)
|
|
@@ -36899,7 +37016,7 @@ async function history(opts) {
|
|
|
36899
37016
|
profile,
|
|
36900
37017
|
profileName,
|
|
36901
37018
|
jsonMode,
|
|
36902
|
-
ttyHeader:
|
|
37019
|
+
ttyHeader: import_picocolors12.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36903
37020
|
fn: (bearer, origin) => apiFetch(
|
|
36904
37021
|
`/api/history?limit=${encodeURIComponent(String(limit))}`,
|
|
36905
37022
|
{ bearer, origin }
|
|
@@ -36912,14 +37029,14 @@ async function history(opts) {
|
|
|
36912
37029
|
);
|
|
36913
37030
|
process.exit(1);
|
|
36914
37031
|
}
|
|
36915
|
-
process.stderr.write(
|
|
37032
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${outcome.reason}.
|
|
36916
37033
|
`));
|
|
36917
37034
|
process.exit(1);
|
|
36918
37035
|
}
|
|
36919
37036
|
if (outcome.kind === "error") {
|
|
36920
37037
|
const err = outcome.error;
|
|
36921
37038
|
if (err instanceof ApiError) {
|
|
36922
|
-
process.stderr.write(
|
|
37039
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36923
37040
|
`));
|
|
36924
37041
|
process.exit(1);
|
|
36925
37042
|
}
|
|
@@ -36936,7 +37053,7 @@ async function history(opts) {
|
|
|
36936
37053
|
return;
|
|
36937
37054
|
}
|
|
36938
37055
|
if (res.txs.length === 0) {
|
|
36939
|
-
process.stdout.write(
|
|
37056
|
+
process.stdout.write(import_picocolors12.default.dim(`No activity yet.
|
|
36940
37057
|
`));
|
|
36941
37058
|
return;
|
|
36942
37059
|
}
|
|
@@ -36956,7 +37073,7 @@ async function history(opts) {
|
|
|
36956
37073
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36957
37074
|
const colTo = Math.max(2, ...rows.map((r) => r.to.length));
|
|
36958
37075
|
const header = "When".padEnd(colWhen) + " " + "Chain".padEnd(colChain) + " " + "Type".padEnd(colType) + " " + "Amount".padStart(colAmount) + " " + "Asset".padEnd(colAsset) + " " + "To".padEnd(colTo) + " Hash";
|
|
36959
|
-
process.stdout.write(
|
|
37076
|
+
process.stdout.write(import_picocolors12.default.dim(header) + "\n");
|
|
36960
37077
|
for (const r of rows) {
|
|
36961
37078
|
process.stdout.write(
|
|
36962
37079
|
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"
|
|
@@ -36964,7 +37081,7 @@ async function history(opts) {
|
|
|
36964
37081
|
}
|
|
36965
37082
|
if (res.fetched_at) {
|
|
36966
37083
|
process.stdout.write(
|
|
36967
|
-
"\n" +
|
|
37084
|
+
"\n" + import_picocolors12.default.dim(
|
|
36968
37085
|
`Showing ${rows.length} of limit ${res.limit ?? limit} \xB7 fetched ${res.fetched_at}
|
|
36969
37086
|
`
|
|
36970
37087
|
)
|
|
@@ -37051,10 +37168,10 @@ function prettyType(activityType, status2) {
|
|
|
37051
37168
|
}
|
|
37052
37169
|
|
|
37053
37170
|
// src/commands/swap.ts
|
|
37054
|
-
var
|
|
37171
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
37055
37172
|
|
|
37056
37173
|
// src/lib/intent-flow.ts
|
|
37057
|
-
var
|
|
37174
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
37058
37175
|
var STREAM_GIVEUP_MS = 10 * 6e4;
|
|
37059
37176
|
var SOLANA_CHAIN_ID2 = 900;
|
|
37060
37177
|
function isBlocked2(r) {
|
|
@@ -37129,7 +37246,7 @@ async function runIntentFlow(opts) {
|
|
|
37129
37246
|
profile: opts.profileName,
|
|
37130
37247
|
jsonMode: opts.jsonMode,
|
|
37131
37248
|
origin: activeProfile.mcpOrigin,
|
|
37132
|
-
ttyHeader:
|
|
37249
|
+
ttyHeader: import_picocolors13.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
37133
37250
|
});
|
|
37134
37251
|
} catch (reloginErr) {
|
|
37135
37252
|
if (opts.jsonMode) {
|
|
@@ -37141,7 +37258,7 @@ async function runIntentFlow(opts) {
|
|
|
37141
37258
|
process.exit(1);
|
|
37142
37259
|
}
|
|
37143
37260
|
process.stderr.write(
|
|
37144
|
-
|
|
37261
|
+
import_picocolors13.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37145
37262
|
`)
|
|
37146
37263
|
);
|
|
37147
37264
|
process.exit(1);
|
|
@@ -37165,7 +37282,7 @@ async function runIntentFlow(opts) {
|
|
|
37165
37282
|
process.exit(1);
|
|
37166
37283
|
}
|
|
37167
37284
|
process.stderr.write(
|
|
37168
|
-
|
|
37285
|
+
import_picocolors13.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
37169
37286
|
`)
|
|
37170
37287
|
);
|
|
37171
37288
|
process.exit(1);
|
|
@@ -37182,7 +37299,7 @@ async function runIntentFlow(opts) {
|
|
|
37182
37299
|
});
|
|
37183
37300
|
process.exit(1);
|
|
37184
37301
|
}
|
|
37185
|
-
process.stderr.write(
|
|
37302
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37186
37303
|
`));
|
|
37187
37304
|
process.exit(1);
|
|
37188
37305
|
} else {
|
|
@@ -37204,18 +37321,18 @@ async function runIntentFlow(opts) {
|
|
|
37204
37321
|
});
|
|
37205
37322
|
process.exit(1);
|
|
37206
37323
|
}
|
|
37207
|
-
process.stderr.write(
|
|
37324
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
|
|
37208
37325
|
`));
|
|
37209
37326
|
if (proposed.upgrade_url) {
|
|
37210
37327
|
process.stderr.write(
|
|
37211
37328
|
` Open this to grant access, then re-run the command:
|
|
37212
|
-
${
|
|
37329
|
+
${import_picocolors13.default.cyan(proposed.upgrade_url)}
|
|
37213
37330
|
`
|
|
37214
37331
|
);
|
|
37215
37332
|
}
|
|
37216
37333
|
if (proposed.recommended_actions && proposed.recommended_actions.length > 0) {
|
|
37217
37334
|
process.stderr.write(
|
|
37218
|
-
|
|
37335
|
+
import_picocolors13.default.dim(
|
|
37219
37336
|
` Suggested actions:
|
|
37220
37337
|
` + proposed.recommended_actions.map((a) => ` \u2022 ${JSON.stringify(a)}`).join("\n") + "\n"
|
|
37221
37338
|
)
|
|
@@ -37238,8 +37355,8 @@ async function runIntentFlow(opts) {
|
|
|
37238
37355
|
} else {
|
|
37239
37356
|
process.stdout.write(
|
|
37240
37357
|
`
|
|
37241
|
-
${
|
|
37242
|
-
${
|
|
37358
|
+
${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
37359
|
+
${import_picocolors13.default.cyan(proposed.approval_url)}
|
|
37243
37360
|
|
|
37244
37361
|
`
|
|
37245
37362
|
);
|
|
@@ -37261,7 +37378,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37261
37378
|
if (opts.jsonMode) {
|
|
37262
37379
|
emitNdjson2({ status: s.status, intent_id: s.approval_id });
|
|
37263
37380
|
} else {
|
|
37264
|
-
process.stdout.write(` ${describeStatus2(s.status)}${
|
|
37381
|
+
process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors13.default.dim("\u2026")}\r`);
|
|
37265
37382
|
}
|
|
37266
37383
|
}
|
|
37267
37384
|
});
|
|
@@ -37275,7 +37392,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37275
37392
|
profile: opts.profileName,
|
|
37276
37393
|
jsonMode: opts.jsonMode,
|
|
37277
37394
|
origin: activeProfile.mcpOrigin,
|
|
37278
|
-
ttyHeader:
|
|
37395
|
+
ttyHeader: import_picocolors13.default.dim(
|
|
37279
37396
|
"Bearer expired mid-poll \u2014 re-pairing this terminal\u2026"
|
|
37280
37397
|
)
|
|
37281
37398
|
});
|
|
@@ -37290,7 +37407,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37290
37407
|
process.exit(1);
|
|
37291
37408
|
}
|
|
37292
37409
|
process.stderr.write(
|
|
37293
|
-
"\n" +
|
|
37410
|
+
"\n" + import_picocolors13.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37294
37411
|
`)
|
|
37295
37412
|
);
|
|
37296
37413
|
process.exit(1);
|
|
@@ -37308,7 +37425,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37308
37425
|
process.exit(1);
|
|
37309
37426
|
}
|
|
37310
37427
|
process.stderr.write(
|
|
37311
|
-
"\n" +
|
|
37428
|
+
"\n" + import_picocolors13.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
37312
37429
|
`)
|
|
37313
37430
|
);
|
|
37314
37431
|
process.exit(1);
|
|
@@ -37324,7 +37441,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37324
37441
|
process.exit(1);
|
|
37325
37442
|
}
|
|
37326
37443
|
process.stderr.write(
|
|
37327
|
-
"\n" +
|
|
37444
|
+
"\n" + import_picocolors13.default.red(`\u2715 Status poll failed: ${err.message}
|
|
37328
37445
|
`)
|
|
37329
37446
|
);
|
|
37330
37447
|
process.exit(1);
|
|
@@ -37365,39 +37482,39 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37365
37482
|
process.stdout.write("\n");
|
|
37366
37483
|
const printLegJournal = () => {
|
|
37367
37484
|
if (legs.length === 0) return;
|
|
37368
|
-
process.stdout.write(
|
|
37485
|
+
process.stdout.write(import_picocolors13.default.bold(" Legs:\n"));
|
|
37369
37486
|
for (const l of legs) {
|
|
37370
|
-
const line = l.status === "mined" ?
|
|
37487
|
+
const line = l.status === "mined" ? import_picocolors13.default.green(`\u2713 leg ${l.index + 1} mined`) + (l.tx_hash ? import_picocolors13.default.dim(` ${l.tx_hash}`) : "") : l.status === "failed" ? import_picocolors13.default.red(`\u2715 leg ${l.index + 1} failed`) + (l.failure?.message ? ` \u2014 ${l.failure.message}` : "") : l.status === "pending" || l.status === "rendered" ? import_picocolors13.default.dim(`\u2013 leg ${l.index + 1} not run`) : import_picocolors13.default.dim(`\u2026 leg ${l.index + 1} ${l.status}`);
|
|
37371
37488
|
process.stdout.write(` ${line}
|
|
37372
37489
|
`);
|
|
37373
37490
|
}
|
|
37374
37491
|
};
|
|
37375
37492
|
if (final.status === "mined") {
|
|
37376
|
-
process.stdout.write(
|
|
37493
|
+
process.stdout.write(import_picocolors13.default.green("\u2713 Mined.") + "\n");
|
|
37377
37494
|
if (final.tx_hash) {
|
|
37378
37495
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
37379
37496
|
`);
|
|
37380
37497
|
}
|
|
37381
37498
|
if (explorer) {
|
|
37382
|
-
process.stdout.write(` Explorer ${
|
|
37499
|
+
process.stdout.write(` Explorer ${import_picocolors13.default.cyan(explorer)}
|
|
37383
37500
|
`);
|
|
37384
37501
|
}
|
|
37385
37502
|
printLegJournal();
|
|
37386
37503
|
process.exit(0);
|
|
37387
37504
|
}
|
|
37388
37505
|
if (final.status === "failed" && failure?.message) {
|
|
37389
|
-
process.stderr.write(
|
|
37506
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${failure.message}
|
|
37390
37507
|
`));
|
|
37391
37508
|
if (retryCommand) {
|
|
37392
37509
|
process.stderr.write(` Retry:
|
|
37393
|
-
${
|
|
37510
|
+
${import_picocolors13.default.cyan(retryCommand)}
|
|
37394
37511
|
`);
|
|
37395
37512
|
}
|
|
37396
37513
|
printLegJournal();
|
|
37397
37514
|
process.exit(1);
|
|
37398
37515
|
}
|
|
37399
37516
|
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}`;
|
|
37400
|
-
process.stderr.write(
|
|
37517
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${label}.
|
|
37401
37518
|
`));
|
|
37402
37519
|
printLegJournal();
|
|
37403
37520
|
process.exit(1);
|
|
@@ -37417,7 +37534,7 @@ function isAsset(v) {
|
|
|
37417
37534
|
return ASSET_VALUES.has(v.toLowerCase());
|
|
37418
37535
|
}
|
|
37419
37536
|
function failArg(msg) {
|
|
37420
|
-
process.stderr.write(
|
|
37537
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${msg}
|
|
37421
37538
|
`));
|
|
37422
37539
|
process.exit(2);
|
|
37423
37540
|
}
|
|
@@ -37425,11 +37542,11 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37425
37542
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37426
37543
|
const resolved = await resolveProfile(requested);
|
|
37427
37544
|
if (!resolved) {
|
|
37428
|
-
process.stderr.write(
|
|
37545
|
+
process.stderr.write(import_picocolors14.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37429
37546
|
process.exit(2);
|
|
37430
37547
|
}
|
|
37431
37548
|
if (resolved.autoSelected) {
|
|
37432
|
-
process.stderr.write(
|
|
37549
|
+
process.stderr.write(import_picocolors14.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37433
37550
|
`));
|
|
37434
37551
|
}
|
|
37435
37552
|
const { profile, name: profileName } = resolved;
|
|
@@ -37437,12 +37554,12 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37437
37554
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37438
37555
|
const amountNumber = Number(amount);
|
|
37439
37556
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37440
|
-
failArg(`amount must be a positive number (got ${
|
|
37557
|
+
failArg(`amount must be a positive number (got ${import_picocolors14.default.bold(amount)}).`);
|
|
37441
37558
|
}
|
|
37442
37559
|
const fromAssetNorm = fromAsset.toLowerCase();
|
|
37443
37560
|
if (!isAsset(fromAssetNorm)) {
|
|
37444
37561
|
failArg(
|
|
37445
|
-
`from-asset must be ${
|
|
37562
|
+
`from-asset must be ${import_picocolors14.default.bold("native")} or ${import_picocolors14.default.bold("usdc")} (got ${import_picocolors14.default.bold(fromAsset)}).`
|
|
37446
37563
|
);
|
|
37447
37564
|
}
|
|
37448
37565
|
if (!opts.toAsset) {
|
|
@@ -37451,7 +37568,7 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37451
37568
|
const toAssetNorm = opts.toAsset.toLowerCase();
|
|
37452
37569
|
if (!isAsset(toAssetNorm)) {
|
|
37453
37570
|
failArg(
|
|
37454
|
-
`--to-asset must be ${
|
|
37571
|
+
`--to-asset must be ${import_picocolors14.default.bold("native")} or ${import_picocolors14.default.bold("usdc")} (got ${import_picocolors14.default.bold(opts.toAsset)}).`
|
|
37455
37572
|
);
|
|
37456
37573
|
}
|
|
37457
37574
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37580,9 +37697,9 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37580
37697
|
}
|
|
37581
37698
|
|
|
37582
37699
|
// src/commands/batch.ts
|
|
37583
|
-
var
|
|
37700
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
37584
37701
|
function failArg2(msg) {
|
|
37585
|
-
process.stderr.write(
|
|
37702
|
+
process.stderr.write(import_picocolors15.default.red(`\u2715 ${msg}
|
|
37586
37703
|
`));
|
|
37587
37704
|
process.exit(2);
|
|
37588
37705
|
}
|
|
@@ -37590,7 +37707,7 @@ async function batch(opts) {
|
|
|
37590
37707
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37591
37708
|
const resolved = await resolveProfile(requested);
|
|
37592
37709
|
if (!resolved) {
|
|
37593
|
-
process.stderr.write(
|
|
37710
|
+
process.stderr.write(import_picocolors15.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37594
37711
|
process.exit(2);
|
|
37595
37712
|
}
|
|
37596
37713
|
const { name: profileName, profile } = resolved;
|
|
@@ -37644,14 +37761,14 @@ async function batch(opts) {
|
|
|
37644
37761
|
}
|
|
37645
37762
|
|
|
37646
37763
|
// src/commands/fund-wallet.ts
|
|
37647
|
-
var
|
|
37764
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
37648
37765
|
var EVM_ADDRESS_RE2 = /^0x[0-9a-fA-F]{40}$/;
|
|
37649
37766
|
var SOLANA_ADDRESS_RE2 = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
37650
37767
|
function isAddressTarget(target) {
|
|
37651
37768
|
return EVM_ADDRESS_RE2.test(target) || SOLANA_ADDRESS_RE2.test(target);
|
|
37652
37769
|
}
|
|
37653
37770
|
function failArg3(msg) {
|
|
37654
|
-
process.stderr.write(
|
|
37771
|
+
process.stderr.write(import_picocolors16.default.red(`\u2715 ${msg}
|
|
37655
37772
|
`));
|
|
37656
37773
|
process.exit(2);
|
|
37657
37774
|
}
|
|
@@ -37659,7 +37776,7 @@ async function fundWallet(address, opts) {
|
|
|
37659
37776
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37660
37777
|
const resolved = await resolveProfile(requested);
|
|
37661
37778
|
if (!resolved) {
|
|
37662
|
-
process.stderr.write(
|
|
37779
|
+
process.stderr.write(import_picocolors16.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37663
37780
|
process.exit(2);
|
|
37664
37781
|
}
|
|
37665
37782
|
const { name: profileName, profile } = resolved;
|
|
@@ -37736,11 +37853,11 @@ async function fundWallet(address, opts) {
|
|
|
37736
37853
|
}
|
|
37737
37854
|
|
|
37738
37855
|
// src/commands/earn-supply.ts
|
|
37739
|
-
var
|
|
37856
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
37740
37857
|
var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37741
37858
|
var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37742
37859
|
function failArg4(msg) {
|
|
37743
|
-
process.stderr.write(
|
|
37860
|
+
process.stderr.write(import_picocolors17.default.red(`\u2715 ${msg}
|
|
37744
37861
|
`));
|
|
37745
37862
|
process.exit(2);
|
|
37746
37863
|
}
|
|
@@ -37748,11 +37865,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37748
37865
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37749
37866
|
const resolved = await resolveProfile(requested);
|
|
37750
37867
|
if (!resolved) {
|
|
37751
|
-
process.stderr.write(
|
|
37868
|
+
process.stderr.write(import_picocolors17.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37752
37869
|
process.exit(2);
|
|
37753
37870
|
}
|
|
37754
37871
|
if (resolved.autoSelected) {
|
|
37755
|
-
process.stderr.write(
|
|
37872
|
+
process.stderr.write(import_picocolors17.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37756
37873
|
`));
|
|
37757
37874
|
}
|
|
37758
37875
|
const { profile, name: profileName } = resolved;
|
|
@@ -37760,12 +37877,12 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37760
37877
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37761
37878
|
const amountNumber = Number(amount);
|
|
37762
37879
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37763
|
-
failArg4(`amount must be a positive number (got ${
|
|
37880
|
+
failArg4(`amount must be a positive number (got ${import_picocolors17.default.bold(amount)}).`);
|
|
37764
37881
|
}
|
|
37765
37882
|
const assetNorm = asset.toLowerCase();
|
|
37766
37883
|
if (!ASSET_VALUES2.has(assetNorm)) {
|
|
37767
37884
|
failArg4(
|
|
37768
|
-
`asset must be ${
|
|
37885
|
+
`asset must be ${import_picocolors17.default.bold("native")} or ${import_picocolors17.default.bold("usdc")} (got ${import_picocolors17.default.bold(asset)}).`
|
|
37769
37886
|
);
|
|
37770
37887
|
}
|
|
37771
37888
|
if (!opts.chain) {
|
|
@@ -37777,7 +37894,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37777
37894
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37778
37895
|
if (!PROTOCOLS.has(protocolNorm)) {
|
|
37779
37896
|
failArg4(
|
|
37780
|
-
`--protocol must be ${
|
|
37897
|
+
`--protocol must be ${import_picocolors17.default.bold("aave_v3")} or ${import_picocolors17.default.bold("kamino_lend")} (got ${import_picocolors17.default.bold(opts.protocol)}).`
|
|
37781
37898
|
);
|
|
37782
37899
|
}
|
|
37783
37900
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37829,11 +37946,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37829
37946
|
}
|
|
37830
37947
|
|
|
37831
37948
|
// src/commands/earn-withdraw.ts
|
|
37832
|
-
var
|
|
37949
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
37833
37950
|
var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37834
37951
|
var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37835
37952
|
function failArg5(msg) {
|
|
37836
|
-
process.stderr.write(
|
|
37953
|
+
process.stderr.write(import_picocolors18.default.red(`\u2715 ${msg}
|
|
37837
37954
|
`));
|
|
37838
37955
|
process.exit(2);
|
|
37839
37956
|
}
|
|
@@ -37841,11 +37958,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37841
37958
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37842
37959
|
const resolved = await resolveProfile(requested);
|
|
37843
37960
|
if (!resolved) {
|
|
37844
|
-
process.stderr.write(
|
|
37961
|
+
process.stderr.write(import_picocolors18.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37845
37962
|
process.exit(2);
|
|
37846
37963
|
}
|
|
37847
37964
|
if (resolved.autoSelected) {
|
|
37848
|
-
process.stderr.write(
|
|
37965
|
+
process.stderr.write(import_picocolors18.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37849
37966
|
`));
|
|
37850
37967
|
}
|
|
37851
37968
|
const { profile, name: profileName } = resolved;
|
|
@@ -37856,14 +37973,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37856
37973
|
const amountNumber = Number(amountOrMax);
|
|
37857
37974
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37858
37975
|
failArg5(
|
|
37859
|
-
`<amount-or-max> must be a positive number or the literal string "max" (got ${
|
|
37976
|
+
`<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors18.default.bold(amountOrMax)}).`
|
|
37860
37977
|
);
|
|
37861
37978
|
}
|
|
37862
37979
|
}
|
|
37863
37980
|
const assetNorm = asset.toLowerCase();
|
|
37864
37981
|
if (!ASSET_VALUES3.has(assetNorm)) {
|
|
37865
37982
|
failArg5(
|
|
37866
|
-
`asset must be ${
|
|
37983
|
+
`asset must be ${import_picocolors18.default.bold("native")} or ${import_picocolors18.default.bold("usdc")} (got ${import_picocolors18.default.bold(asset)}).`
|
|
37867
37984
|
);
|
|
37868
37985
|
}
|
|
37869
37986
|
if (!opts.chain) {
|
|
@@ -37875,7 +37992,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37875
37992
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37876
37993
|
if (!PROTOCOLS2.has(protocolNorm)) {
|
|
37877
37994
|
failArg5(
|
|
37878
|
-
`--protocol must be ${
|
|
37995
|
+
`--protocol must be ${import_picocolors18.default.bold("aave_v3")} or ${import_picocolors18.default.bold("kamino_lend")} (got ${import_picocolors18.default.bold(opts.protocol)}).`
|
|
37879
37996
|
);
|
|
37880
37997
|
}
|
|
37881
37998
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37927,7 +38044,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37927
38044
|
}
|
|
37928
38045
|
|
|
37929
38046
|
// src/commands/eat.ts
|
|
37930
|
-
var
|
|
38047
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
37931
38048
|
function parseLineJson(values) {
|
|
37932
38049
|
const lines = [];
|
|
37933
38050
|
for (const value of values) {
|
|
@@ -37954,11 +38071,11 @@ function parseLineJson(values) {
|
|
|
37954
38071
|
async function loadResolvedProfile(requested) {
|
|
37955
38072
|
const resolved = await resolveProfile(requested);
|
|
37956
38073
|
if (!resolved) {
|
|
37957
|
-
process.stderr.write(
|
|
38074
|
+
process.stderr.write(import_picocolors19.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37958
38075
|
process.exit(2);
|
|
37959
38076
|
}
|
|
37960
38077
|
if (resolved.autoSelected) {
|
|
37961
|
-
process.stderr.write(
|
|
38078
|
+
process.stderr.write(import_picocolors19.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37962
38079
|
`));
|
|
37963
38080
|
}
|
|
37964
38081
|
return resolved;
|
|
@@ -37969,12 +38086,12 @@ function printResult(res, jsonMode) {
|
|
|
37969
38086
|
return;
|
|
37970
38087
|
}
|
|
37971
38088
|
if (res.blocked) {
|
|
37972
|
-
process.stderr.write(
|
|
38089
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
|
|
37973
38090
|
`));
|
|
37974
38091
|
if (res.upgrade_url) {
|
|
37975
38092
|
process.stderr.write(
|
|
37976
38093
|
` Open this to grant access, then re-run the command:
|
|
37977
|
-
${
|
|
38094
|
+
${import_picocolors19.default.cyan(res.upgrade_url)}
|
|
37978
38095
|
`
|
|
37979
38096
|
);
|
|
37980
38097
|
}
|
|
@@ -38005,7 +38122,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38005
38122
|
profile: resolved.profile,
|
|
38006
38123
|
profileName: resolved.name,
|
|
38007
38124
|
jsonMode,
|
|
38008
|
-
ttyHeader:
|
|
38125
|
+
ttyHeader: import_picocolors19.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38009
38126
|
fn: (bearer, origin) => apiFetch(path5, { method: "POST", bearer, origin, body })
|
|
38010
38127
|
});
|
|
38011
38128
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38015,7 +38132,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38015
38132
|
);
|
|
38016
38133
|
process.exit(1);
|
|
38017
38134
|
}
|
|
38018
|
-
process.stderr.write(
|
|
38135
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${outcome.reason}.
|
|
38019
38136
|
`));
|
|
38020
38137
|
process.exit(1);
|
|
38021
38138
|
}
|
|
@@ -38028,7 +38145,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
38028
38145
|
);
|
|
38029
38146
|
process.exit(1);
|
|
38030
38147
|
}
|
|
38031
|
-
process.stderr.write(
|
|
38148
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38032
38149
|
`));
|
|
38033
38150
|
process.exit(1);
|
|
38034
38151
|
}
|
|
@@ -38041,7 +38158,7 @@ async function searchFood(opts) {
|
|
|
38041
38158
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38042
38159
|
if (!opts.location && !opts.name) {
|
|
38043
38160
|
process.stderr.write(
|
|
38044
|
-
|
|
38161
|
+
import_picocolors19.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
|
|
38045
38162
|
);
|
|
38046
38163
|
process.exit(2);
|
|
38047
38164
|
}
|
|
@@ -38062,7 +38179,7 @@ async function menuFood(items, opts) {
|
|
|
38062
38179
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38063
38180
|
if (!opts.brand || !opts.address) {
|
|
38064
38181
|
process.stderr.write(
|
|
38065
|
-
|
|
38182
|
+
import_picocolors19.default.red(
|
|
38066
38183
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38067
38184
|
)
|
|
38068
38185
|
);
|
|
@@ -38082,7 +38199,7 @@ async function orderFood(items, opts) {
|
|
|
38082
38199
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38083
38200
|
if (!opts.brand || !opts.address) {
|
|
38084
38201
|
process.stderr.write(
|
|
38085
|
-
|
|
38202
|
+
import_picocolors19.default.red(
|
|
38086
38203
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38087
38204
|
)
|
|
38088
38205
|
);
|
|
@@ -38092,14 +38209,14 @@ async function orderFood(items, opts) {
|
|
|
38092
38209
|
try {
|
|
38093
38210
|
structuredLines = parseLineJson(opts.lineJson ?? []);
|
|
38094
38211
|
} catch (e) {
|
|
38095
|
-
process.stderr.write(
|
|
38212
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
|
|
38096
38213
|
`));
|
|
38097
38214
|
process.exit(2);
|
|
38098
38215
|
}
|
|
38099
38216
|
const lines = [...items ?? [], ...structuredLines];
|
|
38100
38217
|
if (lines.length === 0) {
|
|
38101
38218
|
process.stderr.write(
|
|
38102
|
-
|
|
38219
|
+
import_picocolors19.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")
|
|
38103
38220
|
);
|
|
38104
38221
|
process.exit(2);
|
|
38105
38222
|
}
|
|
@@ -38133,7 +38250,7 @@ async function orderFood(items, opts) {
|
|
|
38133
38250
|
if (!agentCard.will_attempt) {
|
|
38134
38251
|
if (!jsonMode) {
|
|
38135
38252
|
process.stderr.write(
|
|
38136
|
-
|
|
38253
|
+
import_picocolors19.default.yellow(
|
|
38137
38254
|
`This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
|
|
38138
38255
|
`
|
|
38139
38256
|
)
|
|
@@ -38150,7 +38267,7 @@ async function orderFood(items, opts) {
|
|
|
38150
38267
|
}
|
|
38151
38268
|
if (verdict.status === "paid") {
|
|
38152
38269
|
process.stdout.write(
|
|
38153
|
-
|
|
38270
|
+
import_picocolors19.default.green(
|
|
38154
38271
|
`Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
|
|
38155
38272
|
)
|
|
38156
38273
|
);
|
|
@@ -38158,7 +38275,7 @@ async function orderFood(items, opts) {
|
|
|
38158
38275
|
}
|
|
38159
38276
|
if (verdict.status === "failed") {
|
|
38160
38277
|
process.stderr.write(
|
|
38161
|
-
|
|
38278
|
+
import_picocolors19.default.yellow(
|
|
38162
38279
|
`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.
|
|
38163
38280
|
`
|
|
38164
38281
|
)
|
|
@@ -38168,7 +38285,7 @@ async function orderFood(items, opts) {
|
|
|
38168
38285
|
}
|
|
38169
38286
|
if (verdict.status === "unconfirmed") {
|
|
38170
38287
|
process.stderr.write(
|
|
38171
|
-
|
|
38288
|
+
import_picocolors19.default.red(
|
|
38172
38289
|
"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}
|
|
38173
38290
|
` : "")
|
|
38174
38291
|
)
|
|
@@ -38177,7 +38294,7 @@ async function orderFood(items, opts) {
|
|
|
38177
38294
|
return;
|
|
38178
38295
|
}
|
|
38179
38296
|
process.stderr.write(
|
|
38180
|
-
|
|
38297
|
+
import_picocolors19.default.dim(
|
|
38181
38298
|
`Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
|
|
38182
38299
|
)
|
|
38183
38300
|
);
|
|
@@ -38202,7 +38319,7 @@ var POLL_BUDGET_MS = 1e5;
|
|
|
38202
38319
|
var POLL_INTERVAL_MS2 = 3500;
|
|
38203
38320
|
async function pollOrderVerdict(orderId, resolved, jsonMode) {
|
|
38204
38321
|
if (!jsonMode) {
|
|
38205
|
-
process.stderr.write(
|
|
38322
|
+
process.stderr.write(import_picocolors19.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
|
|
38206
38323
|
}
|
|
38207
38324
|
const deadline = Date.now() + POLL_BUDGET_MS;
|
|
38208
38325
|
let last = {
|
|
@@ -38272,16 +38389,16 @@ async function statusFood(orderId, opts) {
|
|
|
38272
38389
|
}
|
|
38273
38390
|
|
|
38274
38391
|
// src/commands/bounties.ts
|
|
38275
|
-
var
|
|
38392
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
38276
38393
|
async function withProfile(opts, path5, init) {
|
|
38277
38394
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38278
38395
|
const resolved = await resolveProfile(requested);
|
|
38279
38396
|
if (!resolved) {
|
|
38280
|
-
process.stderr.write(
|
|
38397
|
+
process.stderr.write(import_picocolors20.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38281
38398
|
process.exit(2);
|
|
38282
38399
|
}
|
|
38283
38400
|
if (resolved.autoSelected) {
|
|
38284
|
-
process.stderr.write(
|
|
38401
|
+
process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38285
38402
|
`));
|
|
38286
38403
|
}
|
|
38287
38404
|
const { profile, name: profileName } = resolved;
|
|
@@ -38290,7 +38407,7 @@ async function withProfile(opts, path5, init) {
|
|
|
38290
38407
|
profile,
|
|
38291
38408
|
profileName,
|
|
38292
38409
|
jsonMode,
|
|
38293
|
-
ttyHeader:
|
|
38410
|
+
ttyHeader: import_picocolors20.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38294
38411
|
fn: (bearer, origin) => apiFetch(path5, init ? { bearer, origin, method: init.method, body: init.body } : { bearer, origin })
|
|
38295
38412
|
});
|
|
38296
38413
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38298,14 +38415,14 @@ async function withProfile(opts, path5, init) {
|
|
|
38298
38415
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38299
38416
|
process.exit(1);
|
|
38300
38417
|
}
|
|
38301
|
-
process.stderr.write(
|
|
38418
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${outcome.reason}.
|
|
38302
38419
|
`));
|
|
38303
38420
|
process.exit(1);
|
|
38304
38421
|
}
|
|
38305
38422
|
if (outcome.kind === "error") {
|
|
38306
38423
|
const err = outcome.error;
|
|
38307
38424
|
if (err instanceof ApiError) {
|
|
38308
|
-
process.stderr.write(
|
|
38425
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38309
38426
|
`));
|
|
38310
38427
|
process.exit(1);
|
|
38311
38428
|
}
|
|
@@ -38319,12 +38436,12 @@ function handleBlocked(res, jsonMode) {
|
|
|
38319
38436
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38320
38437
|
process.exit(1);
|
|
38321
38438
|
}
|
|
38322
|
-
process.stderr.write(
|
|
38439
|
+
process.stderr.write(import_picocolors20.default.yellow(`
|
|
38323
38440
|
${res.reason ?? "Blocked."}
|
|
38324
38441
|
`));
|
|
38325
38442
|
if (res.upgrade_url) {
|
|
38326
38443
|
process.stderr.write(`
|
|
38327
|
-
${
|
|
38444
|
+
${import_picocolors20.default.bold(res.upgrade_url)}
|
|
38328
38445
|
|
|
38329
38446
|
`);
|
|
38330
38447
|
}
|
|
@@ -38367,14 +38484,14 @@ function printTable(rows) {
|
|
|
38367
38484
|
const cLeft = w("left", 4);
|
|
38368
38485
|
const cSubs = w("subs", 4);
|
|
38369
38486
|
process.stdout.write(
|
|
38370
|
-
|
|
38487
|
+
import_picocolors20.default.dim(
|
|
38371
38488
|
"Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
|
|
38372
38489
|
) + "\n"
|
|
38373
38490
|
);
|
|
38374
38491
|
for (const c of cells) {
|
|
38375
|
-
const title = c.live ?
|
|
38492
|
+
const title = c.live ? import_picocolors20.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
|
|
38376
38493
|
process.stdout.write(
|
|
38377
|
-
|
|
38494
|
+
import_picocolors20.default.bold(c.amount.padStart(cAmount)) + " " + title + " " + c.chain.padEnd(cChain) + " " + c.ev.padEnd(cEv) + " " + c.left.padStart(cLeft) + " " + c.subs.padStart(cSubs) + " " + import_picocolors20.default.dim(c.id) + "\n"
|
|
38378
38495
|
);
|
|
38379
38496
|
}
|
|
38380
38497
|
}
|
|
@@ -38386,11 +38503,11 @@ async function listBounties(opts) {
|
|
|
38386
38503
|
const min = opts.min !== void 0 ? Number(opts.min) : void 0;
|
|
38387
38504
|
const max = opts.max !== void 0 ? Number(opts.max) : void 0;
|
|
38388
38505
|
if (min !== void 0 && !Number.isFinite(min)) {
|
|
38389
|
-
process.stderr.write(
|
|
38506
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --min must be a number.\n"));
|
|
38390
38507
|
process.exit(2);
|
|
38391
38508
|
}
|
|
38392
38509
|
if (max !== void 0 && !Number.isFinite(max)) {
|
|
38393
|
-
process.stderr.write(
|
|
38510
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --max must be a number.\n"));
|
|
38394
38511
|
process.exit(2);
|
|
38395
38512
|
}
|
|
38396
38513
|
rows = rows.filter((r) => {
|
|
@@ -38415,7 +38532,7 @@ async function listBounties(opts) {
|
|
|
38415
38532
|
});
|
|
38416
38533
|
const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
|
|
38417
38534
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
38418
|
-
process.stderr.write(
|
|
38535
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --limit must be a positive number.\n"));
|
|
38419
38536
|
process.exit(2);
|
|
38420
38537
|
}
|
|
38421
38538
|
const shown = rows.slice(0, limit);
|
|
@@ -38424,13 +38541,13 @@ async function listBounties(opts) {
|
|
|
38424
38541
|
return;
|
|
38425
38542
|
}
|
|
38426
38543
|
if (shown.length === 0) {
|
|
38427
|
-
process.stdout.write(
|
|
38544
|
+
process.stdout.write(import_picocolors20.default.dim("No active bounties match.\n"));
|
|
38428
38545
|
return;
|
|
38429
38546
|
}
|
|
38430
38547
|
printTable(shown);
|
|
38431
38548
|
const clipped = rows.length - shown.length;
|
|
38432
38549
|
process.stdout.write(
|
|
38433
|
-
"\n" +
|
|
38550
|
+
"\n" + import_picocolors20.default.dim(
|
|
38434
38551
|
`${shown.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
|
|
38435
38552
|
`
|
|
38436
38553
|
)
|
|
@@ -38441,7 +38558,7 @@ async function showBounty(id, opts) {
|
|
|
38441
38558
|
const jsonMode = opts.json === true;
|
|
38442
38559
|
const clean = id.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
|
|
38443
38560
|
if (!clean) {
|
|
38444
|
-
process.stderr.write(
|
|
38561
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
|
|
38445
38562
|
process.exit(2);
|
|
38446
38563
|
}
|
|
38447
38564
|
const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean)}`);
|
|
@@ -38452,26 +38569,26 @@ async function showBounty(id, opts) {
|
|
|
38452
38569
|
}
|
|
38453
38570
|
const b = res.bounty;
|
|
38454
38571
|
if (!b) {
|
|
38455
|
-
process.stdout.write(
|
|
38572
|
+
process.stdout.write(import_picocolors20.default.dim("Not found.\n"));
|
|
38456
38573
|
return;
|
|
38457
38574
|
}
|
|
38458
|
-
process.stdout.write("\n" +
|
|
38575
|
+
process.stdout.write("\n" + import_picocolors20.default.bold(b.title) + "\n\n");
|
|
38459
38576
|
process.stdout.write(b.description + "\n\n");
|
|
38460
38577
|
process.stdout.write(
|
|
38461
|
-
|
|
38578
|
+
import_picocolors20.default.bold(fmtAmount(b.amount)) + import_picocolors20.default.dim(" USDC") + import_picocolors20.default.dim(` \xB7 ${chainOf2(b)} \xB7 ${b.status.toLowerCase()}`) + (b.liveNow ? import_picocolors20.default.green(" \xB7 LIVE now") : "") + "\n"
|
|
38462
38579
|
);
|
|
38463
38580
|
if (b.claimsAllowed && b.claimsAllowed > 1) {
|
|
38464
38581
|
const left = Math.max(0, b.claimsAllowed - (b.claimsPaid ?? 0));
|
|
38465
38582
|
process.stdout.write(
|
|
38466
|
-
|
|
38583
|
+
import_picocolors20.default.dim(
|
|
38467
38584
|
`${left} of ${b.claimsAllowed} claims left` + (b.perClaimAmount != null ? `, ${fmtAmount(b.perClaimAmount)} each` : "")
|
|
38468
38585
|
) + "\n"
|
|
38469
38586
|
);
|
|
38470
38587
|
}
|
|
38471
|
-
if (b.evidenceType) process.stdout.write(
|
|
38472
|
-
if (b.expiresAt) process.stdout.write(
|
|
38588
|
+
if (b.evidenceType) process.stdout.write(import_picocolors20.default.dim(`Evidence required: ${b.evidenceType}`) + "\n");
|
|
38589
|
+
if (b.expiresAt) process.stdout.write(import_picocolors20.default.dim(`Expires in ${fmtExpiry(b.expiresAt)}`) + "\n");
|
|
38473
38590
|
if (b.geoLabel && b.geoScope !== "global") {
|
|
38474
|
-
process.stdout.write(
|
|
38591
|
+
process.stdout.write(import_picocolors20.default.dim(`Creator says: ${b.geoLabel}`) + "\n");
|
|
38475
38592
|
}
|
|
38476
38593
|
if (res.url) process.stdout.write("\n" + res.url + "\n");
|
|
38477
38594
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38489,7 +38606,7 @@ async function myBounties(opts) {
|
|
|
38489
38606
|
}
|
|
38490
38607
|
if (rows.length === 0) {
|
|
38491
38608
|
process.stdout.write(
|
|
38492
|
-
|
|
38609
|
+
import_picocolors20.default.dim(
|
|
38493
38610
|
status2 ? `No bounties of yours are ${status2}.
|
|
38494
38611
|
` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
|
|
38495
38612
|
)
|
|
@@ -38499,7 +38616,7 @@ async function myBounties(opts) {
|
|
|
38499
38616
|
printTable(rows);
|
|
38500
38617
|
const subs = res.submissions ?? [];
|
|
38501
38618
|
if (subs.length > 0) {
|
|
38502
|
-
process.stdout.write("\n" +
|
|
38619
|
+
process.stdout.write("\n" + import_picocolors20.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
|
|
38503
38620
|
`));
|
|
38504
38621
|
}
|
|
38505
38622
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38518,19 +38635,19 @@ async function bountyFeed(opts) {
|
|
|
38518
38635
|
}
|
|
38519
38636
|
const subs = res.submissions ?? [];
|
|
38520
38637
|
if (subs.length === 0) {
|
|
38521
|
-
process.stdout.write(
|
|
38638
|
+
process.stdout.write(import_picocolors20.default.dim("Nothing in the feed for that filter.\n"));
|
|
38522
38639
|
return;
|
|
38523
38640
|
}
|
|
38524
38641
|
process.stdout.write(
|
|
38525
|
-
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ?
|
|
38642
|
+
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors20.default.dim(" More available.") : "") + "\n"
|
|
38526
38643
|
);
|
|
38527
|
-
process.stdout.write(
|
|
38644
|
+
process.stdout.write(import_picocolors20.default.dim("Use --json for the full rows.\n"));
|
|
38528
38645
|
}
|
|
38529
38646
|
async function draftBounty(opts) {
|
|
38530
38647
|
const jsonMode = opts.json === true;
|
|
38531
38648
|
const amountNum = Number(opts.amount);
|
|
38532
38649
|
if (!Number.isFinite(amountNum) || amountNum <= 0) {
|
|
38533
|
-
process.stderr.write(
|
|
38650
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --amount must be a positive number of USDC.\n"));
|
|
38534
38651
|
process.exit(2);
|
|
38535
38652
|
}
|
|
38536
38653
|
const res = await withProfile(opts, "/api/bounties", {
|
|
@@ -38548,20 +38665,20 @@ async function draftBounty(opts) {
|
|
|
38548
38665
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38549
38666
|
return;
|
|
38550
38667
|
}
|
|
38551
|
-
process.stdout.write("\n" +
|
|
38668
|
+
process.stdout.write("\n" + import_picocolors20.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
|
|
38552
38669
|
|
|
38553
38670
|
`);
|
|
38554
|
-
process.stdout.write(
|
|
38671
|
+
process.stdout.write(import_picocolors20.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
|
|
38555
38672
|
if (res.fund_url) {
|
|
38556
|
-
process.stdout.write("\nFund it here:\n" +
|
|
38557
|
-
process.stdout.write(
|
|
38673
|
+
process.stdout.write("\nFund it here:\n" + import_picocolors20.default.bold(res.fund_url) + "\n\n");
|
|
38674
|
+
process.stdout.write(import_picocolors20.default.dim("Funding happens in your browser with your own wallet.\n"));
|
|
38558
38675
|
}
|
|
38559
38676
|
}
|
|
38560
38677
|
|
|
38561
38678
|
// src/commands/bounty-money.ts
|
|
38562
|
-
var
|
|
38679
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
38563
38680
|
function failArg6(message) {
|
|
38564
|
-
process.stderr.write(
|
|
38681
|
+
process.stderr.write(import_picocolors21.default.red(`${message}
|
|
38565
38682
|
`));
|
|
38566
38683
|
process.exit(2);
|
|
38567
38684
|
}
|
|
@@ -38573,12 +38690,12 @@ async function loadProfileOrExit(requested, jsonMode) {
|
|
|
38573
38690
|
JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
|
|
38574
38691
|
);
|
|
38575
38692
|
} else {
|
|
38576
|
-
process.stderr.write(
|
|
38693
|
+
process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38577
38694
|
}
|
|
38578
38695
|
process.exit(2);
|
|
38579
38696
|
}
|
|
38580
38697
|
if (resolved.autoSelected && !jsonMode) {
|
|
38581
|
-
process.stderr.write(
|
|
38698
|
+
process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38582
38699
|
`));
|
|
38583
38700
|
}
|
|
38584
38701
|
return { profile: resolved.profile, profileName: resolved.name };
|
|
@@ -38683,16 +38800,16 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
38683
38800
|
}
|
|
38684
38801
|
|
|
38685
38802
|
// src/commands/bounty-work.ts
|
|
38686
|
-
var
|
|
38803
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
38687
38804
|
async function runWork(path5, body, opts) {
|
|
38688
38805
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38689
38806
|
const resolved = await resolveProfile(requested);
|
|
38690
38807
|
if (!resolved) {
|
|
38691
|
-
process.stderr.write(
|
|
38808
|
+
process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38692
38809
|
process.exit(2);
|
|
38693
38810
|
}
|
|
38694
38811
|
if (resolved.autoSelected) {
|
|
38695
|
-
process.stderr.write(
|
|
38812
|
+
process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38696
38813
|
`));
|
|
38697
38814
|
}
|
|
38698
38815
|
const jsonMode = opts.json === true;
|
|
@@ -38700,7 +38817,7 @@ async function runWork(path5, body, opts) {
|
|
|
38700
38817
|
profile: resolved.profile,
|
|
38701
38818
|
profileName: resolved.name,
|
|
38702
38819
|
jsonMode,
|
|
38703
|
-
ttyHeader:
|
|
38820
|
+
ttyHeader: import_picocolors22.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38704
38821
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38705
38822
|
});
|
|
38706
38823
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38708,7 +38825,7 @@ async function runWork(path5, body, opts) {
|
|
|
38708
38825
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38709
38826
|
process.exit(1);
|
|
38710
38827
|
}
|
|
38711
|
-
process.stderr.write(
|
|
38828
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${outcome.reason}.
|
|
38712
38829
|
`));
|
|
38713
38830
|
process.exit(1);
|
|
38714
38831
|
}
|
|
@@ -38718,7 +38835,7 @@ async function runWork(path5, body, opts) {
|
|
|
38718
38835
|
if (jsonMode) {
|
|
38719
38836
|
process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
|
|
38720
38837
|
} else {
|
|
38721
|
-
process.stderr.write(
|
|
38838
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38722
38839
|
`));
|
|
38723
38840
|
}
|
|
38724
38841
|
process.exit(1);
|
|
@@ -38731,11 +38848,11 @@ async function runWork(path5, body, opts) {
|
|
|
38731
38848
|
process.stdout.write(JSON.stringify({ ok: false, ...data }) + "\n");
|
|
38732
38849
|
process.exit(1);
|
|
38733
38850
|
}
|
|
38734
|
-
process.stderr.write(
|
|
38851
|
+
process.stderr.write(import_picocolors22.default.yellow(`
|
|
38735
38852
|
${data.reason ?? "Blocked."}
|
|
38736
38853
|
`));
|
|
38737
38854
|
if (data.upgrade_url) process.stderr.write(`
|
|
38738
|
-
${
|
|
38855
|
+
${import_picocolors22.default.bold(data.upgrade_url)}
|
|
38739
38856
|
|
|
38740
38857
|
`);
|
|
38741
38858
|
process.exit(1);
|
|
@@ -38744,7 +38861,7 @@ ${import_picocolors21.default.bold(data.upgrade_url)}
|
|
|
38744
38861
|
if (jsonMode) {
|
|
38745
38862
|
process.stdout.write(JSON.stringify({ ok: false, error: data.error }) + "\n");
|
|
38746
38863
|
} else {
|
|
38747
|
-
process.stderr.write(
|
|
38864
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${data.error}
|
|
38748
38865
|
`));
|
|
38749
38866
|
}
|
|
38750
38867
|
process.exit(1);
|
|
@@ -38787,7 +38904,7 @@ async function bountyRetention(bountyId, opts) {
|
|
|
38787
38904
|
}
|
|
38788
38905
|
|
|
38789
38906
|
// src/commands/bounty-deliver.ts
|
|
38790
|
-
var
|
|
38907
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
38791
38908
|
import { spawn } from "node:child_process";
|
|
38792
38909
|
var FLUSH_MS = 400;
|
|
38793
38910
|
var FLUSH_BYTES = 2048;
|
|
@@ -38796,11 +38913,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38796
38913
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38797
38914
|
const resolved = await resolveProfile(requested);
|
|
38798
38915
|
if (!resolved) {
|
|
38799
|
-
process.stderr.write(
|
|
38916
|
+
process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38800
38917
|
process.exit(2);
|
|
38801
38918
|
}
|
|
38802
38919
|
if (resolved.autoSelected && !jsonMode) {
|
|
38803
|
-
process.stderr.write(
|
|
38920
|
+
process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38804
38921
|
`));
|
|
38805
38922
|
}
|
|
38806
38923
|
const post = async (path5, body) => {
|
|
@@ -38808,7 +38925,7 @@ async function deliver(bountyId, command, opts) {
|
|
|
38808
38925
|
profile: resolved.profile,
|
|
38809
38926
|
profileName: resolved.name,
|
|
38810
38927
|
jsonMode,
|
|
38811
|
-
ttyHeader:
|
|
38928
|
+
ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38812
38929
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38813
38930
|
});
|
|
38814
38931
|
if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
|
|
@@ -38819,11 +38936,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38819
38936
|
if (jsonMode) {
|
|
38820
38937
|
process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data ?? {} }) + "\n");
|
|
38821
38938
|
} else {
|
|
38822
|
-
process.stderr.write(
|
|
38939
|
+
process.stderr.write(import_picocolors23.default.red(`
|
|
38823
38940
|
\u2715 ${msg}
|
|
38824
38941
|
`));
|
|
38825
38942
|
if (data?.upgrade_url) process.stderr.write(`
|
|
38826
|
-
${
|
|
38943
|
+
${import_picocolors23.default.bold(data.upgrade_url)}
|
|
38827
38944
|
|
|
38828
38945
|
`);
|
|
38829
38946
|
}
|
|
@@ -38848,7 +38965,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38848
38965
|
if (!runId) return void die("The service opened a run but did not name it.");
|
|
38849
38966
|
if (!jsonMode) {
|
|
38850
38967
|
process.stderr.write(
|
|
38851
|
-
|
|
38968
|
+
import_picocolors23.default.bold("\n\u25CF LIVE ") + import_picocolors23.default.dim("everything below is going onto the bounty page as it happens\n") + import_picocolors23.default.dim(` ${started.url ?? ""}
|
|
38852
38969
|
|
|
38853
38970
|
`)
|
|
38854
38971
|
);
|
|
@@ -38900,10 +39017,10 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38900
39017
|
child.stdout.on("data", (d) => consume(d));
|
|
38901
39018
|
child.stderr.setEncoding("utf8");
|
|
38902
39019
|
child.stderr.on("data", (d) => {
|
|
38903
|
-
if (!jsonMode) process.stderr.write(
|
|
39020
|
+
if (!jsonMode) process.stderr.write(import_picocolors23.default.dim(d));
|
|
38904
39021
|
});
|
|
38905
39022
|
child.on("error", (err) => {
|
|
38906
|
-
process.stderr.write(
|
|
39023
|
+
process.stderr.write(import_picocolors23.default.red(`
|
|
38907
39024
|
\u2715 Could not run ${command[0]}: ${err.message}
|
|
38908
39025
|
`));
|
|
38909
39026
|
resolve(127);
|
|
@@ -38940,14 +39057,14 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38940
39057
|
}
|
|
38941
39058
|
if (appendFailure) {
|
|
38942
39059
|
process.stderr.write(
|
|
38943
|
-
|
|
39060
|
+
import_picocolors23.default.yellow(`
|
|
38944
39061
|
! Some output did not reach the page: ${appendFailure}
|
|
38945
|
-
`) +
|
|
39062
|
+
`) + import_picocolors23.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
|
|
38946
39063
|
);
|
|
38947
39064
|
}
|
|
38948
39065
|
if (exitCode) {
|
|
38949
39066
|
process.stderr.write(
|
|
38950
|
-
|
|
39067
|
+
import_picocolors23.default.yellow(`
|
|
38951
39068
|
! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
|
|
38952
39069
|
`)
|
|
38953
39070
|
);
|
|
@@ -38957,7 +39074,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38957
39074
|
}
|
|
38958
39075
|
|
|
38959
39076
|
// src/commands/trade.ts
|
|
38960
|
-
var
|
|
39077
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
38961
39078
|
|
|
38962
39079
|
// src/lib/trade-sol.ts
|
|
38963
39080
|
var import_web3 = __toESM(require_index_cjs(), 1);
|
|
@@ -39323,7 +39440,7 @@ function fail(message, json) {
|
|
|
39323
39440
|
if (json) {
|
|
39324
39441
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39325
39442
|
} else {
|
|
39326
|
-
process.stderr.write(
|
|
39443
|
+
process.stderr.write(import_picocolors24.default.red(`\u2715 ${message}
|
|
39327
39444
|
`));
|
|
39328
39445
|
}
|
|
39329
39446
|
process.exit(1);
|
|
@@ -39514,7 +39631,7 @@ async function tradeBuy(coinArg, amount, opts) {
|
|
|
39514
39631
|
}
|
|
39515
39632
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39516
39633
|
if (created && !opts.json) {
|
|
39517
|
-
process.stderr.write(
|
|
39634
|
+
process.stderr.write(import_picocolors24.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39518
39635
|
`));
|
|
39519
39636
|
}
|
|
39520
39637
|
const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
|
|
@@ -39568,7 +39685,7 @@ async function tradeOrderPlace(coinArg, opts) {
|
|
|
39568
39685
|
if (opts.mcap && !opts.at) fail("--mcap qualifies --at.", opts.json);
|
|
39569
39686
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39570
39687
|
if (created && !opts.json) {
|
|
39571
|
-
process.stderr.write(
|
|
39688
|
+
process.stderr.write(import_picocolors24.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39572
39689
|
`));
|
|
39573
39690
|
}
|
|
39574
39691
|
let amount;
|
|
@@ -39733,7 +39850,7 @@ async function tradePositions(opts) {
|
|
|
39733
39850
|
}
|
|
39734
39851
|
|
|
39735
39852
|
// src/commands/desk.ts
|
|
39736
|
-
var
|
|
39853
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
39737
39854
|
|
|
39738
39855
|
// src/lib/desk-sol.ts
|
|
39739
39856
|
var import_web32 = __toESM(require_index_cjs(), 1);
|
|
@@ -39907,7 +40024,7 @@ function fail2(message, json) {
|
|
|
39907
40024
|
if (json) {
|
|
39908
40025
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39909
40026
|
} else {
|
|
39910
|
-
process.stderr.write(
|
|
40027
|
+
process.stderr.write(import_picocolors25.default.red(`\u2715 ${message}
|
|
39911
40028
|
`));
|
|
39912
40029
|
}
|
|
39913
40030
|
process.exit(1);
|
|
@@ -40050,7 +40167,7 @@ async function deskDeposit(amount, opts) {
|
|
|
40050
40167
|
if (units <= 0n) fail2("Deposit amount must be above zero.", opts.json);
|
|
40051
40168
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
40052
40169
|
if (created && !opts.json) {
|
|
40053
|
-
process.stderr.write(
|
|
40170
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
40054
40171
|
`));
|
|
40055
40172
|
}
|
|
40056
40173
|
const result = await runDeskCeremony({
|
|
@@ -40145,13 +40262,13 @@ async function deskSessionRegister(opts) {
|
|
|
40145
40262
|
}
|
|
40146
40263
|
const owner = await loadOrCreateTradeKey();
|
|
40147
40264
|
if (owner.created && !opts.json) {
|
|
40148
|
-
process.stderr.write(
|
|
40265
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
|
|
40149
40266
|
`));
|
|
40150
40267
|
}
|
|
40151
40268
|
const session = await loadOrCreateDeskSessionKey();
|
|
40152
40269
|
if (session.created && !opts.json) {
|
|
40153
40270
|
process.stderr.write(
|
|
40154
|
-
|
|
40271
|
+
import_picocolors25.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
|
|
40155
40272
|
`)
|
|
40156
40273
|
);
|
|
40157
40274
|
}
|
|
@@ -40693,7 +40810,7 @@ program2.command("fund").description(
|
|
|
40693
40810
|
}
|
|
40694
40811
|
if (opts.usdc || opts.gas || opts.chain) {
|
|
40695
40812
|
process.stderr.write(
|
|
40696
|
-
|
|
40813
|
+
import_picocolors26.default.red(
|
|
40697
40814
|
`\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
|
|
40698
40815
|
`
|
|
40699
40816
|
)
|
|
@@ -40812,7 +40929,7 @@ desk.command("buy").description("Buy a launch coin with desk USDC credit (sessio
|
|
|
40812
40929
|
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) => {
|
|
40813
40930
|
await deskSell(coin, amount, opts);
|
|
40814
40931
|
});
|
|
40815
|
-
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").action(async (opts) => {
|
|
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) => {
|
|
40816
40933
|
await onboard(opts);
|
|
40817
40934
|
});
|
|
40818
40935
|
var compute = program2.command("compute").description("Confidential virtual machines by the hour, USDC per payment");
|
|
@@ -40829,11 +40946,18 @@ inference.command("models").description("Live models and per-token prices. Publi
|
|
|
40829
40946
|
inference.command("ask").description("One paid ask (needs an x402 signature this CLI does not have yet)").action(async () => {
|
|
40830
40947
|
await inferenceAsk();
|
|
40831
40948
|
});
|
|
40949
|
+
var phone = program2.command("phone").description("Phone numbers on a plan, texts and calls metered, and a walk-up payphone, USDC over x402");
|
|
40950
|
+
phone.command("pricing").description("Number plans, per-unit usage and the payphone windows. Public read: no key, no account, no payment.").option("--json", "machine-readable output (the phone slice of the identity catalog)").action(async (opts) => {
|
|
40951
|
+
await phonePricing(opts);
|
|
40952
|
+
});
|
|
40953
|
+
phone.command("call").description("Place a payphone call (needs an x402 signature this CLI does not have yet)").action(async () => {
|
|
40954
|
+
await phoneCall();
|
|
40955
|
+
});
|
|
40832
40956
|
program2.parseAsync(process.argv).catch((err) => {
|
|
40833
|
-
process.stderr.write(
|
|
40957
|
+
process.stderr.write(import_picocolors26.default.red(`\u2715 ${err.message}
|
|
40834
40958
|
`));
|
|
40835
40959
|
if (process.env.BOUNTY_DEBUG) {
|
|
40836
|
-
process.stderr.write(
|
|
40960
|
+
process.stderr.write(import_picocolors26.default.dim((err.stack ?? "") + "\n"));
|
|
40837
40961
|
}
|
|
40838
40962
|
process.exit(1);
|
|
40839
40963
|
});
|