@agentgates/cli 0.11.2 → 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 +486 -330
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3113,6 +3113,69 @@ var require_picocolors = __commonJS({
|
|
|
3113
3113
|
}
|
|
3114
3114
|
});
|
|
3115
3115
|
|
|
3116
|
+
// package.json
|
|
3117
|
+
var require_package = __commonJS({
|
|
3118
|
+
"package.json"(exports, module) {
|
|
3119
|
+
module.exports = {
|
|
3120
|
+
name: "@agentgates/cli",
|
|
3121
|
+
version: "0.12.0",
|
|
3122
|
+
description: "Wallet operations for AI agents and humans",
|
|
3123
|
+
keywords: [
|
|
3124
|
+
"crypto",
|
|
3125
|
+
"wallet",
|
|
3126
|
+
"cli",
|
|
3127
|
+
"ai-agent",
|
|
3128
|
+
"agentgates",
|
|
3129
|
+
"usdc",
|
|
3130
|
+
"solana",
|
|
3131
|
+
"ethereum",
|
|
3132
|
+
"polygon",
|
|
3133
|
+
"defi"
|
|
3134
|
+
],
|
|
3135
|
+
license: "MIT",
|
|
3136
|
+
homepage: "https://agentgates.ai",
|
|
3137
|
+
repository: {
|
|
3138
|
+
type: "git",
|
|
3139
|
+
url: "git+https://github.com/Carlos-Sotop/agentgates-ai-cli.git"
|
|
3140
|
+
},
|
|
3141
|
+
author: "Agentgates",
|
|
3142
|
+
type: "module",
|
|
3143
|
+
bin: {
|
|
3144
|
+
agentgates: "bin/agentgates"
|
|
3145
|
+
},
|
|
3146
|
+
files: [
|
|
3147
|
+
"bin",
|
|
3148
|
+
"dist/cli.mjs",
|
|
3149
|
+
"scripts/postinstall.mjs",
|
|
3150
|
+
"README.md"
|
|
3151
|
+
],
|
|
3152
|
+
scripts: {
|
|
3153
|
+
build: `esbuild src/main.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --banner:js="import{createRequire}from'module';const require=createRequire(import.meta.url);"`,
|
|
3154
|
+
"build:tsc": "tsc -p tsconfig.json",
|
|
3155
|
+
postinstall: "node scripts/postinstall.mjs || exit 0",
|
|
3156
|
+
prepare: "[ -x node_modules/.bin/esbuild ] && npm run build || true",
|
|
3157
|
+
dev: "tsc -w -p tsconfig.json",
|
|
3158
|
+
typecheck: "tsc --noEmit",
|
|
3159
|
+
bounty: "node bin/bounty",
|
|
3160
|
+
"sync:bounty-shared": "node scripts/sync-bounty-shared.mjs",
|
|
3161
|
+
clean: "rm -rf dist"
|
|
3162
|
+
},
|
|
3163
|
+
engines: {
|
|
3164
|
+
node: ">=20"
|
|
3165
|
+
},
|
|
3166
|
+
devDependencies: {
|
|
3167
|
+
"@solana/web3.js": "^1.98.4",
|
|
3168
|
+
"@types/node": "^22.10.0",
|
|
3169
|
+
commander: "^12.1.0",
|
|
3170
|
+
esbuild: "^0.28.0",
|
|
3171
|
+
open: "^10.1.0",
|
|
3172
|
+
picocolors: "^1.1.1",
|
|
3173
|
+
typescript: "^5.6.3"
|
|
3174
|
+
}
|
|
3175
|
+
};
|
|
3176
|
+
}
|
|
3177
|
+
});
|
|
3178
|
+
|
|
3116
3179
|
// node_modules/@solana/web3.js/node_modules/@noble/hashes/cryptoNode.js
|
|
3117
3180
|
var require_cryptoNode = __commonJS({
|
|
3118
3181
|
"node_modules/@solana/web3.js/node_modules/@noble/hashes/cryptoNode.js"(exports) {
|
|
@@ -34292,69 +34355,6 @@ Message: ${transactionMessage}.
|
|
|
34292
34355
|
}
|
|
34293
34356
|
});
|
|
34294
34357
|
|
|
34295
|
-
// package.json
|
|
34296
|
-
var require_package = __commonJS({
|
|
34297
|
-
"package.json"(exports, module) {
|
|
34298
|
-
module.exports = {
|
|
34299
|
-
name: "@agentgates/cli",
|
|
34300
|
-
version: "0.11.2",
|
|
34301
|
-
description: "Wallet operations for AI agents and humans",
|
|
34302
|
-
keywords: [
|
|
34303
|
-
"crypto",
|
|
34304
|
-
"wallet",
|
|
34305
|
-
"cli",
|
|
34306
|
-
"ai-agent",
|
|
34307
|
-
"agentgates",
|
|
34308
|
-
"usdc",
|
|
34309
|
-
"solana",
|
|
34310
|
-
"ethereum",
|
|
34311
|
-
"polygon",
|
|
34312
|
-
"defi"
|
|
34313
|
-
],
|
|
34314
|
-
license: "MIT",
|
|
34315
|
-
homepage: "https://agentgates.ai",
|
|
34316
|
-
repository: {
|
|
34317
|
-
type: "git",
|
|
34318
|
-
url: "git+https://github.com/Carlos-Sotop/agentgates-ai-cli.git"
|
|
34319
|
-
},
|
|
34320
|
-
author: "Agentgates",
|
|
34321
|
-
type: "module",
|
|
34322
|
-
bin: {
|
|
34323
|
-
agentgates: "bin/agentgates"
|
|
34324
|
-
},
|
|
34325
|
-
files: [
|
|
34326
|
-
"bin",
|
|
34327
|
-
"dist/cli.mjs",
|
|
34328
|
-
"scripts/postinstall.mjs",
|
|
34329
|
-
"README.md"
|
|
34330
|
-
],
|
|
34331
|
-
scripts: {
|
|
34332
|
-
build: `esbuild src/main.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --banner:js="import{createRequire}from'module';const require=createRequire(import.meta.url);"`,
|
|
34333
|
-
"build:tsc": "tsc -p tsconfig.json",
|
|
34334
|
-
postinstall: "node scripts/postinstall.mjs || exit 0",
|
|
34335
|
-
prepare: "[ -x node_modules/.bin/esbuild ] && npm run build || true",
|
|
34336
|
-
dev: "tsc -w -p tsconfig.json",
|
|
34337
|
-
typecheck: "tsc --noEmit",
|
|
34338
|
-
bounty: "node bin/bounty",
|
|
34339
|
-
"sync:bounty-shared": "node scripts/sync-bounty-shared.mjs",
|
|
34340
|
-
clean: "rm -rf dist"
|
|
34341
|
-
},
|
|
34342
|
-
engines: {
|
|
34343
|
-
node: ">=20"
|
|
34344
|
-
},
|
|
34345
|
-
devDependencies: {
|
|
34346
|
-
"@solana/web3.js": "^1.98.4",
|
|
34347
|
-
"@types/node": "^22.10.0",
|
|
34348
|
-
commander: "^12.1.0",
|
|
34349
|
-
esbuild: "^0.28.0",
|
|
34350
|
-
open: "^10.1.0",
|
|
34351
|
-
picocolors: "^1.1.1",
|
|
34352
|
-
typescript: "^5.6.3"
|
|
34353
|
-
}
|
|
34354
|
-
};
|
|
34355
|
-
}
|
|
34356
|
-
});
|
|
34357
|
-
|
|
34358
34358
|
// node_modules/commander/esm.mjs
|
|
34359
34359
|
var import_index = __toESM(require_commander(), 1);
|
|
34360
34360
|
var {
|
|
@@ -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,35 @@ 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.";
|
|
35713
|
+
var { version: LOCAL_VERSION } = require_package();
|
|
35714
|
+
function olderThan(a, b) {
|
|
35715
|
+
const pa = a.split(".").map(Number);
|
|
35716
|
+
const pb = b.split(".").map(Number);
|
|
35717
|
+
for (let i = 0; i < 3; i++) {
|
|
35718
|
+
if ((pa[i] ?? 0) < (pb[i] ?? 0)) return true;
|
|
35719
|
+
if ((pa[i] ?? 0) > (pb[i] ?? 0)) return false;
|
|
35720
|
+
}
|
|
35721
|
+
return false;
|
|
35722
|
+
}
|
|
35723
|
+
async function staleLine() {
|
|
35724
|
+
try {
|
|
35725
|
+
const ctl = new AbortController();
|
|
35726
|
+
const timer = setTimeout(() => ctl.abort(), 900);
|
|
35727
|
+
const res = await fetch("https://registry.npmjs.org/@agentgates/cli/latest", {
|
|
35728
|
+
headers: { accept: "application/json" },
|
|
35729
|
+
signal: ctl.signal
|
|
35730
|
+
}).finally(() => clearTimeout(timer));
|
|
35731
|
+
if (!res.ok) return null;
|
|
35732
|
+
const { version: latest } = await res.json();
|
|
35733
|
+
if (!latest || !olderThan(LOCAL_VERSION, latest)) return null;
|
|
35734
|
+
return ` ${import_picocolors6.default.yellow("\u2191")} ${latest} is out, this copy is ${LOCAL_VERSION} \xB7 curl -fsSL ${CREATORS_ORIGIN}/api/cli/install | sh
|
|
35735
|
+
|
|
35736
|
+
`;
|
|
35737
|
+
} catch {
|
|
35738
|
+
return null;
|
|
35739
|
+
}
|
|
35740
|
+
}
|
|
35620
35741
|
function makePut(w) {
|
|
35621
35742
|
return (s) => {
|
|
35622
35743
|
process.stdout.write(s);
|
|
@@ -35625,9 +35746,9 @@ function makePut(w) {
|
|
|
35625
35746
|
}
|
|
35626
35747
|
function banner() {
|
|
35627
35748
|
const w = water();
|
|
35628
|
-
if (!w) process.stdout.write("\n" +
|
|
35749
|
+
if (!w) process.stdout.write("\n" + import_picocolors6.default.cyan(WORDMARK) + "\n\n");
|
|
35629
35750
|
const put = makePut(w);
|
|
35630
|
-
put(` ${
|
|
35751
|
+
put(` ${import_picocolors6.default.dim(TAGLINE)}
|
|
35631
35752
|
|
|
35632
35753
|
`);
|
|
35633
35754
|
return { w, put };
|
|
@@ -35635,49 +35756,58 @@ function banner() {
|
|
|
35635
35756
|
var MENU = {
|
|
35636
35757
|
compute: { label: "see virtual machine pricing" },
|
|
35637
35758
|
models: { label: "see inference pricing" },
|
|
35759
|
+
phone: { label: "see phone pricing" },
|
|
35638
35760
|
docs: { label: "read the docs" },
|
|
35639
35761
|
poke: { label: "nothing, I'll poke around" },
|
|
35640
35762
|
wallet: { label: "pair my wallet", hint: "(members only)" }
|
|
35641
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
|
+
}
|
|
35642
35777
|
function menuOrder(lane) {
|
|
35643
|
-
const browse = lane
|
|
35778
|
+
const browse = lanesLedBy(lane).map((l) => LANES[l].key);
|
|
35644
35779
|
return [...browse, "docs", "poke", "wallet"];
|
|
35645
35780
|
}
|
|
35646
35781
|
function printMenu(put, order, first) {
|
|
35647
|
-
put(` ${
|
|
35782
|
+
put(` ${import_picocolors6.default.bold(first ? "choose how to start:" : "what next:")}
|
|
35648
35783
|
`);
|
|
35649
35784
|
order.forEach((k, i) => {
|
|
35650
35785
|
const item = MENU[k];
|
|
35651
|
-
put(` ${
|
|
35786
|
+
put(` ${import_picocolors6.default.cyan(`${i + 1}.`)} ${item.label}${item.hint ? ` ${import_picocolors6.default.dim(item.hint)}` : ""}
|
|
35652
35787
|
`);
|
|
35653
35788
|
});
|
|
35654
35789
|
}
|
|
35655
35790
|
async function printDocs(put, lane) {
|
|
35656
|
-
const lead = lane
|
|
35657
|
-
const
|
|
35658
|
-
const name = (l) => l === "compute" ? "virtual machines" : "inference";
|
|
35791
|
+
const [lead, ...others] = lanesLedBy(lane);
|
|
35792
|
+
const url = (l) => `${CREATORS_ORIGIN}${LANES[l].docs}`;
|
|
35659
35793
|
try {
|
|
35660
|
-
const res = await fetch(
|
|
35661
|
-
headers: { accept: "text/markdown, text/plain" }
|
|
35662
|
-
});
|
|
35794
|
+
const res = await fetch(url(lead), { headers: { accept: "text/markdown, text/plain" } });
|
|
35663
35795
|
if (!res.ok) throw new Error(String(res.status));
|
|
35664
35796
|
const md = (await res.text()).replace(/\s+$/, "");
|
|
35665
35797
|
put(`
|
|
35666
|
-
${
|
|
35798
|
+
${import_picocolors6.default.bold(`THE ${LANES[lead].name.toUpperCase()} CONTRACT`)} ${import_picocolors6.default.dim(url(lead))}
|
|
35667
35799
|
|
|
35668
35800
|
`);
|
|
35669
35801
|
put(md + "\n\n");
|
|
35670
|
-
put(` ${
|
|
35671
|
-
|
|
35802
|
+
for (const other of others) put(` ${import_picocolors6.default.dim(`the ${LANES[other].name} contract:`)} ${url(other)}
|
|
35672
35803
|
`);
|
|
35804
|
+
put("\n");
|
|
35673
35805
|
} catch {
|
|
35674
|
-
put(` ${
|
|
35806
|
+
put(` ${import_picocolors6.default.red("\u2715")} could not fetch the contract; the URLs:
|
|
35675
35807
|
`);
|
|
35676
|
-
put(` ${
|
|
35677
|
-
`);
|
|
35678
|
-
put(` ${import_picocolors5.default.cyan("inference")} ${CREATORS_ORIGIN}/api/inference/docs
|
|
35679
|
-
|
|
35808
|
+
for (const l of LANE_ORDER) put(` ${import_picocolors6.default.cyan(LANES[l].name.padEnd(16))} ${url(l)}
|
|
35680
35809
|
`);
|
|
35810
|
+
put("\n");
|
|
35681
35811
|
}
|
|
35682
35812
|
}
|
|
35683
35813
|
async function onboard(opts = {}) {
|
|
@@ -35685,7 +35815,7 @@ async function onboard(opts = {}) {
|
|
|
35685
35815
|
const { w, put } = banner();
|
|
35686
35816
|
const existing = await loadProfile(profileName).catch(() => null);
|
|
35687
35817
|
if (existing) {
|
|
35688
|
-
put(` ${
|
|
35818
|
+
put(` ${import_picocolors6.default.green("\u2713")} already paired as ${import_picocolors6.default.bold(existing.walletAddress ?? existing.userId)}
|
|
35689
35819
|
|
|
35690
35820
|
`);
|
|
35691
35821
|
}
|
|
@@ -35693,24 +35823,32 @@ async function onboard(opts = {}) {
|
|
|
35693
35823
|
put(` No terminal attached, so no menu. The machine door:
|
|
35694
35824
|
|
|
35695
35825
|
`);
|
|
35696
|
-
put(` agentgates compute plans --json ${
|
|
35826
|
+
put(` agentgates compute plans --json ${import_picocolors6.default.dim("\xB7 virtual machine pricing, JSON")}
|
|
35697
35827
|
`);
|
|
35698
|
-
put(` agentgates inference models --json ${
|
|
35828
|
+
put(` agentgates inference models --json ${import_picocolors6.default.dim("\xB7 model pricing, JSON; --tier --tag --org --search filter it")}
|
|
35699
35829
|
`);
|
|
35700
|
-
put(`
|
|
35830
|
+
put(` agentgates phone pricing --json ${import_picocolors6.default.dim("\xB7 number plans, usage and payphone windows, JSON")}
|
|
35701
35831
|
`);
|
|
35702
|
-
put(` ${CREATORS_ORIGIN}/api/
|
|
35832
|
+
put(` ${CREATORS_ORIGIN}/api/compute/docs ${import_picocolors6.default.dim("\xB7 the buy/read/renew/destroy contract")}
|
|
35703
35833
|
`);
|
|
35704
|
-
put(` ${CREATORS_ORIGIN}/
|
|
35834
|
+
put(` ${CREATORS_ORIGIN}/api/inference/docs ${import_picocolors6.default.dim("\xB7 the chat contract, x402 or Bearer")}
|
|
35835
|
+
`);
|
|
35836
|
+
put(` ${CREATORS_ORIGIN}/api/identity/docs ${import_picocolors6.default.dim("\xB7 the phone contract: plans, numbers, the payphone")}
|
|
35837
|
+
`);
|
|
35838
|
+
put(` ${CREATORS_ORIGIN}/llms.txt ${import_picocolors6.default.dim("\xB7 the whole surface")}
|
|
35705
35839
|
|
|
35706
35840
|
`);
|
|
35707
35841
|
if (!existing) {
|
|
35708
|
-
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.
|
|
35709
35843
|
|
|
35710
35844
|
`);
|
|
35711
35845
|
}
|
|
35846
|
+
const staleNonTty = await staleLine();
|
|
35847
|
+
if (staleNonTty) put(staleNonTty);
|
|
35712
35848
|
return;
|
|
35713
35849
|
}
|
|
35850
|
+
const stale = await staleLine();
|
|
35851
|
+
if (stale) put(stale);
|
|
35714
35852
|
const order = menuOrder(opts.lane).filter((k) => existing ? k !== "wallet" : true);
|
|
35715
35853
|
printMenu(put, order, true);
|
|
35716
35854
|
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -35722,7 +35860,7 @@ async function onboard(opts = {}) {
|
|
|
35722
35860
|
const fallback = first ? "1" : exitDefault;
|
|
35723
35861
|
let choice;
|
|
35724
35862
|
try {
|
|
35725
|
-
choice = (await rl.question(` ${
|
|
35863
|
+
choice = (await rl.question(` ${import_picocolors6.default.dim(`choice [${fallback}]:`)} `)).trim() || fallback;
|
|
35726
35864
|
} catch {
|
|
35727
35865
|
if (first) w?.stop();
|
|
35728
35866
|
process.stdout.write("\n");
|
|
@@ -35746,7 +35884,7 @@ async function onboard(opts = {}) {
|
|
|
35746
35884
|
await runLoginFlow({ profile: profileName, jsonMode: false, ttyHeader: "Pairing this terminal with your wallet\u2026" });
|
|
35747
35885
|
process.stdout.write("\n");
|
|
35748
35886
|
} catch {
|
|
35749
|
-
plain(` ${
|
|
35887
|
+
plain(` ${import_picocolors6.default.red("\u2715")} pairing didn't complete
|
|
35750
35888
|
|
|
35751
35889
|
`);
|
|
35752
35890
|
}
|
|
@@ -35755,7 +35893,7 @@ async function onboard(opts = {}) {
|
|
|
35755
35893
|
try {
|
|
35756
35894
|
await computePlans({});
|
|
35757
35895
|
} catch {
|
|
35758
|
-
plain(` ${
|
|
35896
|
+
plain(` ${import_picocolors6.default.red("\u2715")} could not read the compute catalog
|
|
35759
35897
|
|
|
35760
35898
|
`);
|
|
35761
35899
|
}
|
|
@@ -35764,7 +35902,16 @@ async function onboard(opts = {}) {
|
|
|
35764
35902
|
try {
|
|
35765
35903
|
await inferenceModels({});
|
|
35766
35904
|
} catch {
|
|
35767
|
-
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
|
|
35768
35915
|
|
|
35769
35916
|
`);
|
|
35770
35917
|
}
|
|
@@ -35780,26 +35927,28 @@ async function onboard(opts = {}) {
|
|
|
35780
35927
|
}
|
|
35781
35928
|
}
|
|
35782
35929
|
function printNext(put) {
|
|
35783
|
-
put(` ${
|
|
35930
|
+
put(` ${import_picocolors6.default.dim("agentgates compute plans")} ${import_picocolors6.default.dim("\xB7 virtual machines by the hour")}
|
|
35784
35931
|
`);
|
|
35785
|
-
put(` ${
|
|
35932
|
+
put(` ${import_picocolors6.default.dim("agentgates inference models")} ${import_picocolors6.default.dim("\xB7 models by the token")}
|
|
35786
35933
|
`);
|
|
35787
|
-
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")}
|
|
35788
35937
|
|
|
35789
35938
|
`);
|
|
35790
35939
|
}
|
|
35791
35940
|
|
|
35792
35941
|
// src/commands/logout.ts
|
|
35793
|
-
var
|
|
35942
|
+
var import_picocolors7 = __toESM(require_picocolors(), 1);
|
|
35794
35943
|
async function logout(opts) {
|
|
35795
35944
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35796
35945
|
const resolved = await resolveProfile(requested);
|
|
35797
35946
|
if (!resolved) {
|
|
35798
|
-
process.stdout.write(
|
|
35947
|
+
process.stdout.write(import_picocolors7.default.dim("Not logged in \u2014 nothing to log out.\n"));
|
|
35799
35948
|
return;
|
|
35800
35949
|
}
|
|
35801
35950
|
if (resolved.autoSelected) {
|
|
35802
|
-
process.stderr.write(
|
|
35951
|
+
process.stderr.write(import_picocolors7.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35803
35952
|
`));
|
|
35804
35953
|
}
|
|
35805
35954
|
const { profile, name: profileName } = resolved;
|
|
@@ -35824,15 +35973,15 @@ async function logout(opts) {
|
|
|
35824
35973
|
const removed = await deleteProfile(profileName);
|
|
35825
35974
|
if (removed) {
|
|
35826
35975
|
process.stdout.write(
|
|
35827
|
-
|
|
35976
|
+
import_picocolors7.default.green(`\u2713 Logged out of profile ${import_picocolors7.default.bold(profileName)}.
|
|
35828
35977
|
`)
|
|
35829
35978
|
);
|
|
35830
35979
|
}
|
|
35831
35980
|
if (serverError) {
|
|
35832
35981
|
process.stderr.write(
|
|
35833
|
-
|
|
35982
|
+
import_picocolors7.default.yellow(
|
|
35834
35983
|
`\u26A0 Couldn't revoke server-side: ${serverError}
|
|
35835
|
-
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")}.
|
|
35836
35985
|
`
|
|
35837
35986
|
)
|
|
35838
35987
|
);
|
|
@@ -35840,16 +35989,16 @@ async function logout(opts) {
|
|
|
35840
35989
|
}
|
|
35841
35990
|
|
|
35842
35991
|
// src/commands/whoami.ts
|
|
35843
|
-
var
|
|
35992
|
+
var import_picocolors8 = __toESM(require_picocolors(), 1);
|
|
35844
35993
|
async function whoami(opts) {
|
|
35845
35994
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
35846
35995
|
const resolved = await resolveProfile(requested);
|
|
35847
35996
|
if (!resolved) {
|
|
35848
|
-
process.stderr.write(
|
|
35997
|
+
process.stderr.write(import_picocolors8.default.red("Not logged in. Run agentgates login first.\n"));
|
|
35849
35998
|
process.exit(2);
|
|
35850
35999
|
}
|
|
35851
36000
|
if (resolved.autoSelected) {
|
|
35852
|
-
process.stderr.write(
|
|
36001
|
+
process.stderr.write(import_picocolors8.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
35853
36002
|
`));
|
|
35854
36003
|
}
|
|
35855
36004
|
const { profile, name: profileName } = resolved;
|
|
@@ -35858,7 +36007,7 @@ async function whoami(opts) {
|
|
|
35858
36007
|
profile,
|
|
35859
36008
|
profileName,
|
|
35860
36009
|
jsonMode,
|
|
35861
|
-
ttyHeader:
|
|
36010
|
+
ttyHeader: import_picocolors8.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
35862
36011
|
fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
|
|
35863
36012
|
});
|
|
35864
36013
|
if (outcome.kind === "auth_failed") {
|
|
@@ -35868,14 +36017,14 @@ async function whoami(opts) {
|
|
|
35868
36017
|
);
|
|
35869
36018
|
process.exit(1);
|
|
35870
36019
|
}
|
|
35871
|
-
process.stderr.write(
|
|
36020
|
+
process.stderr.write(import_picocolors8.default.red(`\u2715 ${outcome.reason}.
|
|
35872
36021
|
`));
|
|
35873
36022
|
process.exit(1);
|
|
35874
36023
|
}
|
|
35875
36024
|
if (outcome.kind === "error") {
|
|
35876
36025
|
const err = outcome.error;
|
|
35877
36026
|
if (err instanceof ApiError) {
|
|
35878
|
-
process.stderr.write(
|
|
36027
|
+
process.stderr.write(import_picocolors8.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
35879
36028
|
`));
|
|
35880
36029
|
process.exit(1);
|
|
35881
36030
|
}
|
|
@@ -35896,7 +36045,7 @@ async function whoami(opts) {
|
|
|
35896
36045
|
process.stdout.write(`Solana ${me.solanaAddress}
|
|
35897
36046
|
`);
|
|
35898
36047
|
}
|
|
35899
|
-
process.stdout.write(`Scopes ${me.scopes.join(", ") ||
|
|
36048
|
+
process.stdout.write(`Scopes ${me.scopes.join(", ") || import_picocolors8.default.dim("(none)")}
|
|
35900
36049
|
`);
|
|
35901
36050
|
const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
|
|
35902
36051
|
const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
|
|
@@ -35913,7 +36062,7 @@ async function whoami(opts) {
|
|
|
35913
36062
|
`
|
|
35914
36063
|
);
|
|
35915
36064
|
process.stdout.write(
|
|
35916
|
-
`Profile ${profileName === DEFAULT_PROFILE ?
|
|
36065
|
+
`Profile ${profileName === DEFAULT_PROFILE ? import_picocolors8.default.dim("(default)") : profileName}
|
|
35917
36066
|
`
|
|
35918
36067
|
);
|
|
35919
36068
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -35927,7 +36076,7 @@ function formatDate(iso) {
|
|
|
35927
36076
|
}
|
|
35928
36077
|
|
|
35929
36078
|
// src/commands/send.ts
|
|
35930
|
-
var
|
|
36079
|
+
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
35931
36080
|
|
|
35932
36081
|
// src/lib/status.ts
|
|
35933
36082
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
@@ -36077,11 +36226,11 @@ async function send(amount, asset, opts) {
|
|
|
36077
36226
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36078
36227
|
const resolved = await resolveProfile(requested);
|
|
36079
36228
|
if (!resolved) {
|
|
36080
|
-
process.stderr.write(
|
|
36229
|
+
process.stderr.write(import_picocolors9.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36081
36230
|
process.exit(2);
|
|
36082
36231
|
}
|
|
36083
36232
|
if (resolved.autoSelected) {
|
|
36084
|
-
process.stderr.write(
|
|
36233
|
+
process.stderr.write(import_picocolors9.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36085
36234
|
`));
|
|
36086
36235
|
}
|
|
36087
36236
|
const { profile, name: profileName } = resolved;
|
|
@@ -36090,7 +36239,7 @@ async function send(amount, asset, opts) {
|
|
|
36090
36239
|
const amountNumber = Number(amount);
|
|
36091
36240
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
36092
36241
|
process.stderr.write(
|
|
36093
|
-
|
|
36242
|
+
import_picocolors9.default.red(`\u2715 amount must be a positive number (got ${import_picocolors9.default.bold(amount)}).
|
|
36094
36243
|
`)
|
|
36095
36244
|
);
|
|
36096
36245
|
process.exit(2);
|
|
@@ -36098,23 +36247,23 @@ async function send(amount, asset, opts) {
|
|
|
36098
36247
|
const assetNormalized = asset.toLowerCase();
|
|
36099
36248
|
if (assetNormalized !== "native" && assetNormalized !== "usdc") {
|
|
36100
36249
|
process.stderr.write(
|
|
36101
|
-
|
|
36102
|
-
`\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)}).
|
|
36103
36252
|
`
|
|
36104
36253
|
)
|
|
36105
36254
|
);
|
|
36106
36255
|
process.exit(2);
|
|
36107
36256
|
}
|
|
36108
36257
|
if (!opts.to || opts.to.trim() === "") {
|
|
36109
|
-
process.stderr.write(
|
|
36258
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 --to <address> is required.
|
|
36110
36259
|
`));
|
|
36111
36260
|
process.exit(2);
|
|
36112
36261
|
}
|
|
36113
36262
|
if (isSolanaChainAlias(opts.chain)) {
|
|
36114
36263
|
if (EVM_ADDRESS_RE.test(opts.to)) {
|
|
36115
36264
|
process.stderr.write(
|
|
36116
|
-
|
|
36117
|
-
`\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.
|
|
36118
36267
|
`
|
|
36119
36268
|
)
|
|
36120
36269
|
);
|
|
@@ -36122,10 +36271,10 @@ async function send(amount, asset, opts) {
|
|
|
36122
36271
|
}
|
|
36123
36272
|
if (!SOLANA_ADDRESS_RE.test(opts.to)) {
|
|
36124
36273
|
process.stderr.write(
|
|
36125
|
-
|
|
36126
|
-
`\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)}).
|
|
36127
36276
|
`
|
|
36128
|
-
) +
|
|
36277
|
+
) + import_picocolors9.default.dim(
|
|
36129
36278
|
` SNS resolution is deferred to a future server-side change;
|
|
36130
36279
|
for now Solana sends require the literal pubkey.
|
|
36131
36280
|
`
|
|
@@ -36136,8 +36285,8 @@ async function send(amount, asset, opts) {
|
|
|
36136
36285
|
}
|
|
36137
36286
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
36138
36287
|
process.stderr.write(
|
|
36139
|
-
|
|
36140
|
-
`) +
|
|
36288
|
+
import_picocolors9.default.red(`\u2715 --user-stated <text> is required.
|
|
36289
|
+
`) + import_picocolors9.default.dim(
|
|
36141
36290
|
` This is the trust-gap defense: pass the verbatim user request so
|
|
36142
36291
|
the approval modal can cross-check what the agent thinks the user
|
|
36143
36292
|
asked for vs. the actual decoded transaction.
|
|
@@ -36155,7 +36304,7 @@ async function send(amount, asset, opts) {
|
|
|
36155
36304
|
const n = Number(opts.maxUsd);
|
|
36156
36305
|
if (!Number.isFinite(n) || n <= 0) {
|
|
36157
36306
|
process.stderr.write(
|
|
36158
|
-
|
|
36307
|
+
import_picocolors9.default.red(`\u2715 --max-usd must be a positive number (got ${opts.maxUsd}).
|
|
36159
36308
|
`)
|
|
36160
36309
|
);
|
|
36161
36310
|
process.exit(2);
|
|
@@ -36197,7 +36346,7 @@ async function send(amount, asset, opts) {
|
|
|
36197
36346
|
profile: profileName,
|
|
36198
36347
|
jsonMode,
|
|
36199
36348
|
origin: activeProfile.mcpOrigin,
|
|
36200
|
-
ttyHeader:
|
|
36349
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
36201
36350
|
});
|
|
36202
36351
|
} catch (reloginErr) {
|
|
36203
36352
|
if (jsonMode) {
|
|
@@ -36209,7 +36358,7 @@ async function send(amount, asset, opts) {
|
|
|
36209
36358
|
process.exit(1);
|
|
36210
36359
|
}
|
|
36211
36360
|
process.stderr.write(
|
|
36212
|
-
|
|
36361
|
+
import_picocolors9.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36213
36362
|
`)
|
|
36214
36363
|
);
|
|
36215
36364
|
process.exit(1);
|
|
@@ -36233,7 +36382,7 @@ async function send(amount, asset, opts) {
|
|
|
36233
36382
|
process.exit(1);
|
|
36234
36383
|
}
|
|
36235
36384
|
process.stderr.write(
|
|
36236
|
-
|
|
36385
|
+
import_picocolors9.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
36237
36386
|
`)
|
|
36238
36387
|
);
|
|
36239
36388
|
process.exit(1);
|
|
@@ -36250,7 +36399,7 @@ async function send(amount, asset, opts) {
|
|
|
36250
36399
|
});
|
|
36251
36400
|
process.exit(1);
|
|
36252
36401
|
}
|
|
36253
|
-
process.stderr.write(
|
|
36402
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36254
36403
|
`));
|
|
36255
36404
|
process.exit(1);
|
|
36256
36405
|
} else {
|
|
@@ -36276,17 +36425,17 @@ async function send(amount, asset, opts) {
|
|
|
36276
36425
|
if (proposed.detail) {
|
|
36277
36426
|
const d = proposed.detail;
|
|
36278
36427
|
process.stderr.write(
|
|
36279
|
-
|
|
36428
|
+
import_picocolors9.default.red(`\u2715 ${d.asset_symbol ?? "Asset"} on ${d.chain_name ?? "chain"}: `) + `have ${d.balance}, need ${d.required} (short ${d.deficit})
|
|
36280
36429
|
`
|
|
36281
36430
|
);
|
|
36282
36431
|
} else {
|
|
36283
|
-
process.stderr.write(
|
|
36432
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${proposed.reason}
|
|
36284
36433
|
`));
|
|
36285
36434
|
}
|
|
36286
36435
|
if (proposed.upgrade_url) {
|
|
36287
36436
|
process.stderr.write(
|
|
36288
36437
|
` Open this to grant access, then re-run the command:
|
|
36289
|
-
${
|
|
36438
|
+
${import_picocolors9.default.cyan(proposed.upgrade_url)}
|
|
36290
36439
|
`
|
|
36291
36440
|
);
|
|
36292
36441
|
}
|
|
@@ -36296,21 +36445,21 @@ async function send(amount, asset, opts) {
|
|
|
36296
36445
|
const a = proposed.recommended_actions[i];
|
|
36297
36446
|
process.stderr.write(` ${i + 1}. ${a.label}
|
|
36298
36447
|
`);
|
|
36299
|
-
if (a.reasoning) process.stderr.write(
|
|
36448
|
+
if (a.reasoning) process.stderr.write(import_picocolors9.default.dim(` ${a.reasoning}
|
|
36300
36449
|
`));
|
|
36301
36450
|
if (a.action_intent && a.action_intent.external_url) {
|
|
36302
36451
|
process.stderr.write(
|
|
36303
|
-
` ${
|
|
36452
|
+
` ${import_picocolors9.default.cyan(a.action_intent.external_url)}
|
|
36304
36453
|
`
|
|
36305
36454
|
);
|
|
36306
36455
|
}
|
|
36307
36456
|
}
|
|
36308
36457
|
}
|
|
36309
36458
|
if (proposed.suggestions && proposed.suggestions.length > 0) {
|
|
36310
|
-
process.stderr.write(
|
|
36459
|
+
process.stderr.write(import_picocolors9.default.dim("\n Other ways to fund:\n"));
|
|
36311
36460
|
for (const s of proposed.suggestions) {
|
|
36312
36461
|
if (s.kind === "ask_user") continue;
|
|
36313
|
-
process.stderr.write(
|
|
36462
|
+
process.stderr.write(import_picocolors9.default.dim(` \u2022 ${s.label}
|
|
36314
36463
|
`));
|
|
36315
36464
|
}
|
|
36316
36465
|
}
|
|
@@ -36337,8 +36486,8 @@ async function send(amount, asset, opts) {
|
|
|
36337
36486
|
} else {
|
|
36338
36487
|
process.stdout.write(
|
|
36339
36488
|
`
|
|
36340
|
-
${
|
|
36341
|
-
${
|
|
36489
|
+
${import_picocolors9.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
36490
|
+
${import_picocolors9.default.cyan(proposed.approval_url)}
|
|
36342
36491
|
|
|
36343
36492
|
`
|
|
36344
36493
|
);
|
|
@@ -36357,7 +36506,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36357
36506
|
if (jsonMode) {
|
|
36358
36507
|
emitNdjson({ status: s.status, intent_id: s.approval_id });
|
|
36359
36508
|
} else {
|
|
36360
|
-
process.stdout.write(` ${describeStatus(s.status)}${
|
|
36509
|
+
process.stdout.write(` ${describeStatus(s.status)}${import_picocolors9.default.dim("\u2026")}\r`);
|
|
36361
36510
|
}
|
|
36362
36511
|
}
|
|
36363
36512
|
});
|
|
@@ -36371,7 +36520,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36371
36520
|
profile: profileName,
|
|
36372
36521
|
jsonMode,
|
|
36373
36522
|
origin: activeProfile.mcpOrigin,
|
|
36374
|
-
ttyHeader:
|
|
36523
|
+
ttyHeader: import_picocolors9.default.dim("Bearer expired mid-poll \u2014 re-pairing this terminal\u2026")
|
|
36375
36524
|
});
|
|
36376
36525
|
} catch (reloginErr) {
|
|
36377
36526
|
if (jsonMode) {
|
|
@@ -36384,7 +36533,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36384
36533
|
process.exit(1);
|
|
36385
36534
|
}
|
|
36386
36535
|
process.stderr.write(
|
|
36387
|
-
"\n" +
|
|
36536
|
+
"\n" + import_picocolors9.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36388
36537
|
`)
|
|
36389
36538
|
);
|
|
36390
36539
|
process.exit(1);
|
|
@@ -36402,7 +36551,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36402
36551
|
process.exit(1);
|
|
36403
36552
|
}
|
|
36404
36553
|
process.stderr.write(
|
|
36405
|
-
"\n" +
|
|
36554
|
+
"\n" + import_picocolors9.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
36406
36555
|
`)
|
|
36407
36556
|
);
|
|
36408
36557
|
process.exit(1);
|
|
@@ -36418,7 +36567,7 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36418
36567
|
process.exit(1);
|
|
36419
36568
|
}
|
|
36420
36569
|
process.stderr.write(
|
|
36421
|
-
"\n" +
|
|
36570
|
+
"\n" + import_picocolors9.default.red(`\u2715 Status poll failed: ${err.message}
|
|
36422
36571
|
`)
|
|
36423
36572
|
);
|
|
36424
36573
|
process.exit(1);
|
|
@@ -36438,19 +36587,19 @@ ${import_picocolors8.default.bold("Proposed.")} Open this URL to approve with bi
|
|
|
36438
36587
|
}
|
|
36439
36588
|
process.stdout.write("\n");
|
|
36440
36589
|
if (final.status === "mined") {
|
|
36441
|
-
process.stdout.write(
|
|
36590
|
+
process.stdout.write(import_picocolors9.default.green("\u2713 Mined.") + "\n");
|
|
36442
36591
|
if (final.tx_hash) {
|
|
36443
36592
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
36444
36593
|
`);
|
|
36445
36594
|
}
|
|
36446
36595
|
if (explorer) {
|
|
36447
|
-
process.stdout.write(` Explorer ${
|
|
36596
|
+
process.stdout.write(` Explorer ${import_picocolors9.default.cyan(explorer)}
|
|
36448
36597
|
`);
|
|
36449
36598
|
}
|
|
36450
36599
|
process.exit(0);
|
|
36451
36600
|
}
|
|
36452
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}`;
|
|
36453
|
-
process.stderr.write(
|
|
36602
|
+
process.stderr.write(import_picocolors9.default.red(`\u2715 ${label}.
|
|
36454
36603
|
`));
|
|
36455
36604
|
process.exit(1);
|
|
36456
36605
|
}
|
|
@@ -36478,7 +36627,7 @@ function describeStatus(s) {
|
|
|
36478
36627
|
}
|
|
36479
36628
|
|
|
36480
36629
|
// src/commands/status.ts
|
|
36481
|
-
var
|
|
36630
|
+
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
36482
36631
|
var WATCH_GIVEUP_MS = 10 * 6e4;
|
|
36483
36632
|
function explorerUrl2(chainId, hash) {
|
|
36484
36633
|
switch (chainId) {
|
|
@@ -36496,17 +36645,17 @@ function explorerUrl2(chainId, hash) {
|
|
|
36496
36645
|
}
|
|
36497
36646
|
async function status(intentId, opts) {
|
|
36498
36647
|
if (!intentId || intentId.trim() === "") {
|
|
36499
|
-
process.stderr.write(
|
|
36648
|
+
process.stderr.write(import_picocolors10.default.red("\u2715 Missing intent id.\n"));
|
|
36500
36649
|
process.exit(2);
|
|
36501
36650
|
}
|
|
36502
36651
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36503
36652
|
const resolved = await resolveProfile(requested);
|
|
36504
36653
|
if (!resolved) {
|
|
36505
|
-
process.stderr.write(
|
|
36654
|
+
process.stderr.write(import_picocolors10.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36506
36655
|
process.exit(2);
|
|
36507
36656
|
}
|
|
36508
36657
|
if (resolved.autoSelected) {
|
|
36509
|
-
process.stderr.write(
|
|
36658
|
+
process.stderr.write(import_picocolors10.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36510
36659
|
`));
|
|
36511
36660
|
}
|
|
36512
36661
|
const { profile, name: profileName } = resolved;
|
|
@@ -36515,7 +36664,7 @@ async function status(intentId, opts) {
|
|
|
36515
36664
|
profile,
|
|
36516
36665
|
profileName,
|
|
36517
36666
|
jsonMode,
|
|
36518
|
-
ttyHeader:
|
|
36667
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36519
36668
|
fn: (bearer, origin) => fetchStatus({ intentId, bearer, origin })
|
|
36520
36669
|
});
|
|
36521
36670
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36525,7 +36674,7 @@ async function status(intentId, opts) {
|
|
|
36525
36674
|
);
|
|
36526
36675
|
process.exit(1);
|
|
36527
36676
|
}
|
|
36528
|
-
process.stderr.write(
|
|
36677
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${outcome.reason}.
|
|
36529
36678
|
`));
|
|
36530
36679
|
process.exit(1);
|
|
36531
36680
|
}
|
|
@@ -36533,11 +36682,11 @@ async function status(intentId, opts) {
|
|
|
36533
36682
|
const err = outcome.error;
|
|
36534
36683
|
if (err instanceof ApiError) {
|
|
36535
36684
|
if (err.status === 404) {
|
|
36536
|
-
process.stderr.write(
|
|
36685
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 No intent with id ${intentId}.
|
|
36537
36686
|
`));
|
|
36538
36687
|
process.exit(1);
|
|
36539
36688
|
}
|
|
36540
|
-
process.stderr.write(
|
|
36689
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36541
36690
|
`));
|
|
36542
36691
|
process.exit(1);
|
|
36543
36692
|
}
|
|
@@ -36548,7 +36697,7 @@ async function status(intentId, opts) {
|
|
|
36548
36697
|
if (opts.watch && !isTerminalStatus(snap.status)) {
|
|
36549
36698
|
if (!jsonMode) {
|
|
36550
36699
|
printSnap(snap);
|
|
36551
|
-
process.stdout.write(
|
|
36700
|
+
process.stdout.write(import_picocolors10.default.dim("Watching\u2026\n"));
|
|
36552
36701
|
}
|
|
36553
36702
|
const runWatchPoll = (p) => streamStatusUntilTerminal({
|
|
36554
36703
|
intentId,
|
|
@@ -36559,7 +36708,7 @@ async function status(intentId, opts) {
|
|
|
36559
36708
|
giveUpMs: WATCH_GIVEUP_MS,
|
|
36560
36709
|
onTick: (s) => {
|
|
36561
36710
|
if (!jsonMode) {
|
|
36562
|
-
process.stdout.write(` ${
|
|
36711
|
+
process.stdout.write(` ${import_picocolors10.default.dim("\u2192")} ${s.status}
|
|
36563
36712
|
`);
|
|
36564
36713
|
}
|
|
36565
36714
|
}
|
|
@@ -36574,7 +36723,7 @@ async function status(intentId, opts) {
|
|
|
36574
36723
|
profile: profileName,
|
|
36575
36724
|
jsonMode,
|
|
36576
36725
|
origin: activeProfile.mcpOrigin,
|
|
36577
|
-
ttyHeader:
|
|
36726
|
+
ttyHeader: import_picocolors10.default.dim("Bearer expired mid-watch \u2014 re-pairing\u2026")
|
|
36578
36727
|
});
|
|
36579
36728
|
} catch (reloginErr) {
|
|
36580
36729
|
if (jsonMode) {
|
|
@@ -36588,7 +36737,7 @@ async function status(intentId, opts) {
|
|
|
36588
36737
|
process.exit(1);
|
|
36589
36738
|
}
|
|
36590
36739
|
process.stderr.write(
|
|
36591
|
-
|
|
36740
|
+
import_picocolors10.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
36592
36741
|
`)
|
|
36593
36742
|
);
|
|
36594
36743
|
process.exit(1);
|
|
@@ -36596,12 +36745,12 @@ async function status(intentId, opts) {
|
|
|
36596
36745
|
try {
|
|
36597
36746
|
final = await runWatchPoll(activeProfile);
|
|
36598
36747
|
} catch (retryErr) {
|
|
36599
|
-
process.stderr.write(
|
|
36748
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${retryErr.message}
|
|
36600
36749
|
`));
|
|
36601
36750
|
process.exit(1);
|
|
36602
36751
|
}
|
|
36603
36752
|
} else {
|
|
36604
|
-
process.stderr.write(
|
|
36753
|
+
process.stderr.write(import_picocolors10.default.red(`\u2715 ${err.message}
|
|
36605
36754
|
`));
|
|
36606
36755
|
process.exit(1);
|
|
36607
36756
|
}
|
|
@@ -36622,7 +36771,7 @@ async function status(intentId, opts) {
|
|
|
36622
36771
|
}
|
|
36623
36772
|
function printSnap(s) {
|
|
36624
36773
|
const explorer = s.tx_hash ? explorerUrl2(s.chain_id, s.tx_hash) : null;
|
|
36625
|
-
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;
|
|
36626
36775
|
process.stdout.write(`Intent ${s.approval_id}
|
|
36627
36776
|
`);
|
|
36628
36777
|
process.stdout.write(`Status ${colorFn(s.status)}
|
|
@@ -36637,12 +36786,12 @@ function printSnap(s) {
|
|
|
36637
36786
|
process.stdout.write(`Tx ${s.tx_hash}
|
|
36638
36787
|
`);
|
|
36639
36788
|
if (explorer) {
|
|
36640
|
-
process.stdout.write(`Explorer ${
|
|
36789
|
+
process.stdout.write(`Explorer ${import_picocolors10.default.cyan(explorer)}
|
|
36641
36790
|
`);
|
|
36642
36791
|
}
|
|
36643
36792
|
}
|
|
36644
36793
|
if (!isTerminalStatus(s.status)) {
|
|
36645
|
-
process.stdout.write(`Approve ${
|
|
36794
|
+
process.stdout.write(`Approve ${import_picocolors10.default.cyan(s.approval_url)}
|
|
36646
36795
|
`);
|
|
36647
36796
|
}
|
|
36648
36797
|
process.stdout.write(`Created ${formatDate2(s.created_at)}
|
|
@@ -36659,7 +36808,7 @@ function formatDate2(iso) {
|
|
|
36659
36808
|
}
|
|
36660
36809
|
|
|
36661
36810
|
// src/commands/balance.ts
|
|
36662
|
-
var
|
|
36811
|
+
var import_picocolors11 = __toESM(require_picocolors(), 1);
|
|
36663
36812
|
var CHAIN_ALIASES = {
|
|
36664
36813
|
"1": 1,
|
|
36665
36814
|
ethereum: 1,
|
|
@@ -36682,11 +36831,11 @@ async function balance(opts) {
|
|
|
36682
36831
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36683
36832
|
const resolved = await resolveProfile(requested);
|
|
36684
36833
|
if (!resolved) {
|
|
36685
|
-
process.stderr.write(
|
|
36834
|
+
process.stderr.write(import_picocolors11.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36686
36835
|
process.exit(2);
|
|
36687
36836
|
}
|
|
36688
36837
|
if (resolved.autoSelected) {
|
|
36689
|
-
process.stderr.write(
|
|
36838
|
+
process.stderr.write(import_picocolors11.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36690
36839
|
`));
|
|
36691
36840
|
}
|
|
36692
36841
|
const { profile, name: profileName } = resolved;
|
|
@@ -36696,8 +36845,8 @@ async function balance(opts) {
|
|
|
36696
36845
|
const id = CHAIN_ALIASES[key];
|
|
36697
36846
|
if (id === void 0) {
|
|
36698
36847
|
process.stderr.write(
|
|
36699
|
-
|
|
36700
|
-
`\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")}.
|
|
36701
36850
|
`
|
|
36702
36851
|
)
|
|
36703
36852
|
);
|
|
@@ -36710,7 +36859,7 @@ async function balance(opts) {
|
|
|
36710
36859
|
profile,
|
|
36711
36860
|
profileName,
|
|
36712
36861
|
jsonMode,
|
|
36713
|
-
ttyHeader:
|
|
36862
|
+
ttyHeader: import_picocolors11.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36714
36863
|
fn: (bearer, origin) => apiFetch("/api/balances", { bearer, origin })
|
|
36715
36864
|
});
|
|
36716
36865
|
if (outcome.kind === "auth_failed") {
|
|
@@ -36720,14 +36869,14 @@ async function balance(opts) {
|
|
|
36720
36869
|
);
|
|
36721
36870
|
process.exit(1);
|
|
36722
36871
|
}
|
|
36723
|
-
process.stderr.write(
|
|
36872
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${outcome.reason}.
|
|
36724
36873
|
`));
|
|
36725
36874
|
process.exit(1);
|
|
36726
36875
|
}
|
|
36727
36876
|
if (outcome.kind === "error") {
|
|
36728
36877
|
const err = outcome.error;
|
|
36729
36878
|
if (err instanceof ApiError) {
|
|
36730
|
-
process.stderr.write(
|
|
36879
|
+
process.stderr.write(import_picocolors11.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36731
36880
|
`));
|
|
36732
36881
|
process.exit(1);
|
|
36733
36882
|
}
|
|
@@ -36757,7 +36906,7 @@ async function balance(opts) {
|
|
|
36757
36906
|
}
|
|
36758
36907
|
if (filtered.length === 0) {
|
|
36759
36908
|
process.stdout.write(
|
|
36760
|
-
|
|
36909
|
+
import_picocolors11.default.dim(
|
|
36761
36910
|
chainFilter !== null ? `No balances on chain ${chainFilter}.
|
|
36762
36911
|
` : `No chain balances returned.
|
|
36763
36912
|
`
|
|
@@ -36769,7 +36918,7 @@ async function balance(opts) {
|
|
|
36769
36918
|
const errorLines = [];
|
|
36770
36919
|
for (const c of filtered) {
|
|
36771
36920
|
if (c.error) {
|
|
36772
|
-
errorLines.push(`${c.chainName} ${
|
|
36921
|
+
errorLines.push(`${c.chainName} ${import_picocolors11.default.red(`(read failed: ${c.error})`)}`);
|
|
36773
36922
|
continue;
|
|
36774
36923
|
}
|
|
36775
36924
|
if (c.native.balance > 0) {
|
|
@@ -36790,7 +36939,7 @@ async function balance(opts) {
|
|
|
36790
36939
|
}
|
|
36791
36940
|
}
|
|
36792
36941
|
if (rows.length === 0 && errorLines.length === 0) {
|
|
36793
|
-
process.stdout.write(
|
|
36942
|
+
process.stdout.write(import_picocolors11.default.dim(`All balances are zero.
|
|
36794
36943
|
`));
|
|
36795
36944
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
36796
36945
|
return;
|
|
@@ -36800,7 +36949,7 @@ async function balance(opts) {
|
|
|
36800
36949
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36801
36950
|
const colBalance = Math.max(7, ...rows.map((r) => r.balance.length));
|
|
36802
36951
|
const header = "Chain".padEnd(colChain) + " " + "Asset".padEnd(colAsset) + " " + "Balance".padStart(colBalance);
|
|
36803
|
-
process.stdout.write(
|
|
36952
|
+
process.stdout.write(import_picocolors11.default.dim(header) + "\n");
|
|
36804
36953
|
for (const r of rows) {
|
|
36805
36954
|
process.stdout.write(
|
|
36806
36955
|
r.chain.padEnd(colChain) + " " + r.asset.padEnd(colAsset) + " " + r.balance.padStart(colBalance) + "\n"
|
|
@@ -36813,7 +36962,7 @@ async function balance(opts) {
|
|
|
36813
36962
|
`);
|
|
36814
36963
|
}
|
|
36815
36964
|
if (res.fetched_at) {
|
|
36816
|
-
process.stdout.write("\n" +
|
|
36965
|
+
process.stdout.write("\n" + import_picocolors11.default.dim(`Fetched ${res.fetched_at}
|
|
36817
36966
|
`));
|
|
36818
36967
|
}
|
|
36819
36968
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -36826,18 +36975,18 @@ function formatBalance(value, decimals) {
|
|
|
36826
36975
|
}
|
|
36827
36976
|
|
|
36828
36977
|
// src/commands/history.ts
|
|
36829
|
-
var
|
|
36978
|
+
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
36830
36979
|
var DEFAULT_LIMIT = 20;
|
|
36831
36980
|
var SERVER_MAX_LIMIT = 100;
|
|
36832
36981
|
async function history(opts) {
|
|
36833
36982
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
36834
36983
|
const resolved = await resolveProfile(requested);
|
|
36835
36984
|
if (!resolved) {
|
|
36836
|
-
process.stderr.write(
|
|
36985
|
+
process.stderr.write(import_picocolors12.default.red("Not logged in. Run agentgates login first.\n"));
|
|
36837
36986
|
process.exit(2);
|
|
36838
36987
|
}
|
|
36839
36988
|
if (resolved.autoSelected) {
|
|
36840
|
-
process.stderr.write(
|
|
36989
|
+
process.stderr.write(import_picocolors12.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
36841
36990
|
`));
|
|
36842
36991
|
}
|
|
36843
36992
|
const { profile, name: profileName } = resolved;
|
|
@@ -36846,14 +36995,14 @@ async function history(opts) {
|
|
|
36846
36995
|
const n = Number(opts.limit);
|
|
36847
36996
|
if (!Number.isFinite(n) || n <= 0 || !Number.isInteger(n)) {
|
|
36848
36997
|
process.stderr.write(
|
|
36849
|
-
|
|
36998
|
+
import_picocolors12.default.red(`\u2715 --limit must be a positive integer (got ${import_picocolors12.default.bold(opts.limit)}).
|
|
36850
36999
|
`)
|
|
36851
37000
|
);
|
|
36852
37001
|
process.exit(2);
|
|
36853
37002
|
}
|
|
36854
37003
|
if (n > SERVER_MAX_LIMIT) {
|
|
36855
37004
|
process.stderr.write(
|
|
36856
|
-
|
|
37005
|
+
import_picocolors12.default.red(
|
|
36857
37006
|
`\u2715 --limit max is ${SERVER_MAX_LIMIT} (the server's wallet://history hard cap). Got ${n}.
|
|
36858
37007
|
`
|
|
36859
37008
|
)
|
|
@@ -36867,7 +37016,7 @@ async function history(opts) {
|
|
|
36867
37016
|
profile,
|
|
36868
37017
|
profileName,
|
|
36869
37018
|
jsonMode,
|
|
36870
|
-
ttyHeader:
|
|
37019
|
+
ttyHeader: import_picocolors12.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
36871
37020
|
fn: (bearer, origin) => apiFetch(
|
|
36872
37021
|
`/api/history?limit=${encodeURIComponent(String(limit))}`,
|
|
36873
37022
|
{ bearer, origin }
|
|
@@ -36880,14 +37029,14 @@ async function history(opts) {
|
|
|
36880
37029
|
);
|
|
36881
37030
|
process.exit(1);
|
|
36882
37031
|
}
|
|
36883
|
-
process.stderr.write(
|
|
37032
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${outcome.reason}.
|
|
36884
37033
|
`));
|
|
36885
37034
|
process.exit(1);
|
|
36886
37035
|
}
|
|
36887
37036
|
if (outcome.kind === "error") {
|
|
36888
37037
|
const err = outcome.error;
|
|
36889
37038
|
if (err instanceof ApiError) {
|
|
36890
|
-
process.stderr.write(
|
|
37039
|
+
process.stderr.write(import_picocolors12.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
36891
37040
|
`));
|
|
36892
37041
|
process.exit(1);
|
|
36893
37042
|
}
|
|
@@ -36904,7 +37053,7 @@ async function history(opts) {
|
|
|
36904
37053
|
return;
|
|
36905
37054
|
}
|
|
36906
37055
|
if (res.txs.length === 0) {
|
|
36907
|
-
process.stdout.write(
|
|
37056
|
+
process.stdout.write(import_picocolors12.default.dim(`No activity yet.
|
|
36908
37057
|
`));
|
|
36909
37058
|
return;
|
|
36910
37059
|
}
|
|
@@ -36924,7 +37073,7 @@ async function history(opts) {
|
|
|
36924
37073
|
const colAsset = Math.max(5, ...rows.map((r) => r.asset.length));
|
|
36925
37074
|
const colTo = Math.max(2, ...rows.map((r) => r.to.length));
|
|
36926
37075
|
const header = "When".padEnd(colWhen) + " " + "Chain".padEnd(colChain) + " " + "Type".padEnd(colType) + " " + "Amount".padStart(colAmount) + " " + "Asset".padEnd(colAsset) + " " + "To".padEnd(colTo) + " Hash";
|
|
36927
|
-
process.stdout.write(
|
|
37076
|
+
process.stdout.write(import_picocolors12.default.dim(header) + "\n");
|
|
36928
37077
|
for (const r of rows) {
|
|
36929
37078
|
process.stdout.write(
|
|
36930
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"
|
|
@@ -36932,7 +37081,7 @@ async function history(opts) {
|
|
|
36932
37081
|
}
|
|
36933
37082
|
if (res.fetched_at) {
|
|
36934
37083
|
process.stdout.write(
|
|
36935
|
-
"\n" +
|
|
37084
|
+
"\n" + import_picocolors12.default.dim(
|
|
36936
37085
|
`Showing ${rows.length} of limit ${res.limit ?? limit} \xB7 fetched ${res.fetched_at}
|
|
36937
37086
|
`
|
|
36938
37087
|
)
|
|
@@ -37019,10 +37168,10 @@ function prettyType(activityType, status2) {
|
|
|
37019
37168
|
}
|
|
37020
37169
|
|
|
37021
37170
|
// src/commands/swap.ts
|
|
37022
|
-
var
|
|
37171
|
+
var import_picocolors14 = __toESM(require_picocolors(), 1);
|
|
37023
37172
|
|
|
37024
37173
|
// src/lib/intent-flow.ts
|
|
37025
|
-
var
|
|
37174
|
+
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
37026
37175
|
var STREAM_GIVEUP_MS = 10 * 6e4;
|
|
37027
37176
|
var SOLANA_CHAIN_ID2 = 900;
|
|
37028
37177
|
function isBlocked2(r) {
|
|
@@ -37097,7 +37246,7 @@ async function runIntentFlow(opts) {
|
|
|
37097
37246
|
profile: opts.profileName,
|
|
37098
37247
|
jsonMode: opts.jsonMode,
|
|
37099
37248
|
origin: activeProfile.mcpOrigin,
|
|
37100
|
-
ttyHeader:
|
|
37249
|
+
ttyHeader: import_picocolors13.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026")
|
|
37101
37250
|
});
|
|
37102
37251
|
} catch (reloginErr) {
|
|
37103
37252
|
if (opts.jsonMode) {
|
|
@@ -37109,7 +37258,7 @@ async function runIntentFlow(opts) {
|
|
|
37109
37258
|
process.exit(1);
|
|
37110
37259
|
}
|
|
37111
37260
|
process.stderr.write(
|
|
37112
|
-
|
|
37261
|
+
import_picocolors13.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37113
37262
|
`)
|
|
37114
37263
|
);
|
|
37115
37264
|
process.exit(1);
|
|
@@ -37133,7 +37282,7 @@ async function runIntentFlow(opts) {
|
|
|
37133
37282
|
process.exit(1);
|
|
37134
37283
|
}
|
|
37135
37284
|
process.stderr.write(
|
|
37136
|
-
|
|
37285
|
+
import_picocolors13.default.red(`\u2715 ${retryErr.message} (HTTP ${retryErr.status})
|
|
37137
37286
|
`)
|
|
37138
37287
|
);
|
|
37139
37288
|
process.exit(1);
|
|
@@ -37150,7 +37299,7 @@ async function runIntentFlow(opts) {
|
|
|
37150
37299
|
});
|
|
37151
37300
|
process.exit(1);
|
|
37152
37301
|
}
|
|
37153
|
-
process.stderr.write(
|
|
37302
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
37154
37303
|
`));
|
|
37155
37304
|
process.exit(1);
|
|
37156
37305
|
} else {
|
|
@@ -37172,18 +37321,18 @@ async function runIntentFlow(opts) {
|
|
|
37172
37321
|
});
|
|
37173
37322
|
process.exit(1);
|
|
37174
37323
|
}
|
|
37175
|
-
process.stderr.write(
|
|
37324
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
|
|
37176
37325
|
`));
|
|
37177
37326
|
if (proposed.upgrade_url) {
|
|
37178
37327
|
process.stderr.write(
|
|
37179
37328
|
` Open this to grant access, then re-run the command:
|
|
37180
|
-
${
|
|
37329
|
+
${import_picocolors13.default.cyan(proposed.upgrade_url)}
|
|
37181
37330
|
`
|
|
37182
37331
|
);
|
|
37183
37332
|
}
|
|
37184
37333
|
if (proposed.recommended_actions && proposed.recommended_actions.length > 0) {
|
|
37185
37334
|
process.stderr.write(
|
|
37186
|
-
|
|
37335
|
+
import_picocolors13.default.dim(
|
|
37187
37336
|
` Suggested actions:
|
|
37188
37337
|
` + proposed.recommended_actions.map((a) => ` \u2022 ${JSON.stringify(a)}`).join("\n") + "\n"
|
|
37189
37338
|
)
|
|
@@ -37206,8 +37355,8 @@ async function runIntentFlow(opts) {
|
|
|
37206
37355
|
} else {
|
|
37207
37356
|
process.stdout.write(
|
|
37208
37357
|
`
|
|
37209
|
-
${
|
|
37210
|
-
${
|
|
37358
|
+
${import_picocolors13.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
37359
|
+
${import_picocolors13.default.cyan(proposed.approval_url)}
|
|
37211
37360
|
|
|
37212
37361
|
`
|
|
37213
37362
|
);
|
|
@@ -37229,7 +37378,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37229
37378
|
if (opts.jsonMode) {
|
|
37230
37379
|
emitNdjson2({ status: s.status, intent_id: s.approval_id });
|
|
37231
37380
|
} else {
|
|
37232
|
-
process.stdout.write(` ${describeStatus2(s.status)}${
|
|
37381
|
+
process.stdout.write(` ${describeStatus2(s.status)}${import_picocolors13.default.dim("\u2026")}\r`);
|
|
37233
37382
|
}
|
|
37234
37383
|
}
|
|
37235
37384
|
});
|
|
@@ -37243,7 +37392,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37243
37392
|
profile: opts.profileName,
|
|
37244
37393
|
jsonMode: opts.jsonMode,
|
|
37245
37394
|
origin: activeProfile.mcpOrigin,
|
|
37246
|
-
ttyHeader:
|
|
37395
|
+
ttyHeader: import_picocolors13.default.dim(
|
|
37247
37396
|
"Bearer expired mid-poll \u2014 re-pairing this terminal\u2026"
|
|
37248
37397
|
)
|
|
37249
37398
|
});
|
|
@@ -37258,7 +37407,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37258
37407
|
process.exit(1);
|
|
37259
37408
|
}
|
|
37260
37409
|
process.stderr.write(
|
|
37261
|
-
"\n" +
|
|
37410
|
+
"\n" + import_picocolors13.default.red(`\u2715 Auto-relogin failed: ${reloginErr.message}
|
|
37262
37411
|
`)
|
|
37263
37412
|
);
|
|
37264
37413
|
process.exit(1);
|
|
@@ -37276,7 +37425,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37276
37425
|
process.exit(1);
|
|
37277
37426
|
}
|
|
37278
37427
|
process.stderr.write(
|
|
37279
|
-
"\n" +
|
|
37428
|
+
"\n" + import_picocolors13.default.red(`\u2715 Status poll failed: ${retryErr.message}
|
|
37280
37429
|
`)
|
|
37281
37430
|
);
|
|
37282
37431
|
process.exit(1);
|
|
@@ -37292,7 +37441,7 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37292
37441
|
process.exit(1);
|
|
37293
37442
|
}
|
|
37294
37443
|
process.stderr.write(
|
|
37295
|
-
"\n" +
|
|
37444
|
+
"\n" + import_picocolors13.default.red(`\u2715 Status poll failed: ${err.message}
|
|
37296
37445
|
`)
|
|
37297
37446
|
);
|
|
37298
37447
|
process.exit(1);
|
|
@@ -37333,39 +37482,39 @@ ${import_picocolors12.default.bold("Proposed.")} Open this URL to approve with b
|
|
|
37333
37482
|
process.stdout.write("\n");
|
|
37334
37483
|
const printLegJournal = () => {
|
|
37335
37484
|
if (legs.length === 0) return;
|
|
37336
|
-
process.stdout.write(
|
|
37485
|
+
process.stdout.write(import_picocolors13.default.bold(" Legs:\n"));
|
|
37337
37486
|
for (const l of legs) {
|
|
37338
|
-
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}`);
|
|
37339
37488
|
process.stdout.write(` ${line}
|
|
37340
37489
|
`);
|
|
37341
37490
|
}
|
|
37342
37491
|
};
|
|
37343
37492
|
if (final.status === "mined") {
|
|
37344
|
-
process.stdout.write(
|
|
37493
|
+
process.stdout.write(import_picocolors13.default.green("\u2713 Mined.") + "\n");
|
|
37345
37494
|
if (final.tx_hash) {
|
|
37346
37495
|
process.stdout.write(` Tx ${final.tx_hash}
|
|
37347
37496
|
`);
|
|
37348
37497
|
}
|
|
37349
37498
|
if (explorer) {
|
|
37350
|
-
process.stdout.write(` Explorer ${
|
|
37499
|
+
process.stdout.write(` Explorer ${import_picocolors13.default.cyan(explorer)}
|
|
37351
37500
|
`);
|
|
37352
37501
|
}
|
|
37353
37502
|
printLegJournal();
|
|
37354
37503
|
process.exit(0);
|
|
37355
37504
|
}
|
|
37356
37505
|
if (final.status === "failed" && failure?.message) {
|
|
37357
|
-
process.stderr.write(
|
|
37506
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${failure.message}
|
|
37358
37507
|
`));
|
|
37359
37508
|
if (retryCommand) {
|
|
37360
37509
|
process.stderr.write(` Retry:
|
|
37361
|
-
${
|
|
37510
|
+
${import_picocolors13.default.cyan(retryCommand)}
|
|
37362
37511
|
`);
|
|
37363
37512
|
}
|
|
37364
37513
|
printLegJournal();
|
|
37365
37514
|
process.exit(1);
|
|
37366
37515
|
}
|
|
37367
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}`;
|
|
37368
|
-
process.stderr.write(
|
|
37517
|
+
process.stderr.write(import_picocolors13.default.red(`\u2715 ${label}.
|
|
37369
37518
|
`));
|
|
37370
37519
|
printLegJournal();
|
|
37371
37520
|
process.exit(1);
|
|
@@ -37385,7 +37534,7 @@ function isAsset(v) {
|
|
|
37385
37534
|
return ASSET_VALUES.has(v.toLowerCase());
|
|
37386
37535
|
}
|
|
37387
37536
|
function failArg(msg) {
|
|
37388
|
-
process.stderr.write(
|
|
37537
|
+
process.stderr.write(import_picocolors14.default.red(`\u2715 ${msg}
|
|
37389
37538
|
`));
|
|
37390
37539
|
process.exit(2);
|
|
37391
37540
|
}
|
|
@@ -37393,11 +37542,11 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37393
37542
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37394
37543
|
const resolved = await resolveProfile(requested);
|
|
37395
37544
|
if (!resolved) {
|
|
37396
|
-
process.stderr.write(
|
|
37545
|
+
process.stderr.write(import_picocolors14.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37397
37546
|
process.exit(2);
|
|
37398
37547
|
}
|
|
37399
37548
|
if (resolved.autoSelected) {
|
|
37400
|
-
process.stderr.write(
|
|
37549
|
+
process.stderr.write(import_picocolors14.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37401
37550
|
`));
|
|
37402
37551
|
}
|
|
37403
37552
|
const { profile, name: profileName } = resolved;
|
|
@@ -37405,12 +37554,12 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37405
37554
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37406
37555
|
const amountNumber = Number(amount);
|
|
37407
37556
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37408
|
-
failArg(`amount must be a positive number (got ${
|
|
37557
|
+
failArg(`amount must be a positive number (got ${import_picocolors14.default.bold(amount)}).`);
|
|
37409
37558
|
}
|
|
37410
37559
|
const fromAssetNorm = fromAsset.toLowerCase();
|
|
37411
37560
|
if (!isAsset(fromAssetNorm)) {
|
|
37412
37561
|
failArg(
|
|
37413
|
-
`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)}).`
|
|
37414
37563
|
);
|
|
37415
37564
|
}
|
|
37416
37565
|
if (!opts.toAsset) {
|
|
@@ -37419,7 +37568,7 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37419
37568
|
const toAssetNorm = opts.toAsset.toLowerCase();
|
|
37420
37569
|
if (!isAsset(toAssetNorm)) {
|
|
37421
37570
|
failArg(
|
|
37422
|
-
`--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)}).`
|
|
37423
37572
|
);
|
|
37424
37573
|
}
|
|
37425
37574
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37548,9 +37697,9 @@ async function swap(amount, fromAsset, opts) {
|
|
|
37548
37697
|
}
|
|
37549
37698
|
|
|
37550
37699
|
// src/commands/batch.ts
|
|
37551
|
-
var
|
|
37700
|
+
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
37552
37701
|
function failArg2(msg) {
|
|
37553
|
-
process.stderr.write(
|
|
37702
|
+
process.stderr.write(import_picocolors15.default.red(`\u2715 ${msg}
|
|
37554
37703
|
`));
|
|
37555
37704
|
process.exit(2);
|
|
37556
37705
|
}
|
|
@@ -37558,7 +37707,7 @@ async function batch(opts) {
|
|
|
37558
37707
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37559
37708
|
const resolved = await resolveProfile(requested);
|
|
37560
37709
|
if (!resolved) {
|
|
37561
|
-
process.stderr.write(
|
|
37710
|
+
process.stderr.write(import_picocolors15.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37562
37711
|
process.exit(2);
|
|
37563
37712
|
}
|
|
37564
37713
|
const { name: profileName, profile } = resolved;
|
|
@@ -37612,14 +37761,14 @@ async function batch(opts) {
|
|
|
37612
37761
|
}
|
|
37613
37762
|
|
|
37614
37763
|
// src/commands/fund-wallet.ts
|
|
37615
|
-
var
|
|
37764
|
+
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
37616
37765
|
var EVM_ADDRESS_RE2 = /^0x[0-9a-fA-F]{40}$/;
|
|
37617
37766
|
var SOLANA_ADDRESS_RE2 = /^[1-9A-HJ-NP-Za-km-z]{32,44}$/;
|
|
37618
37767
|
function isAddressTarget(target) {
|
|
37619
37768
|
return EVM_ADDRESS_RE2.test(target) || SOLANA_ADDRESS_RE2.test(target);
|
|
37620
37769
|
}
|
|
37621
37770
|
function failArg3(msg) {
|
|
37622
|
-
process.stderr.write(
|
|
37771
|
+
process.stderr.write(import_picocolors16.default.red(`\u2715 ${msg}
|
|
37623
37772
|
`));
|
|
37624
37773
|
process.exit(2);
|
|
37625
37774
|
}
|
|
@@ -37627,7 +37776,7 @@ async function fundWallet(address, opts) {
|
|
|
37627
37776
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37628
37777
|
const resolved = await resolveProfile(requested);
|
|
37629
37778
|
if (!resolved) {
|
|
37630
|
-
process.stderr.write(
|
|
37779
|
+
process.stderr.write(import_picocolors16.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37631
37780
|
process.exit(2);
|
|
37632
37781
|
}
|
|
37633
37782
|
const { name: profileName, profile } = resolved;
|
|
@@ -37704,11 +37853,11 @@ async function fundWallet(address, opts) {
|
|
|
37704
37853
|
}
|
|
37705
37854
|
|
|
37706
37855
|
// src/commands/earn-supply.ts
|
|
37707
|
-
var
|
|
37856
|
+
var import_picocolors17 = __toESM(require_picocolors(), 1);
|
|
37708
37857
|
var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37709
37858
|
var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37710
37859
|
function failArg4(msg) {
|
|
37711
|
-
process.stderr.write(
|
|
37860
|
+
process.stderr.write(import_picocolors17.default.red(`\u2715 ${msg}
|
|
37712
37861
|
`));
|
|
37713
37862
|
process.exit(2);
|
|
37714
37863
|
}
|
|
@@ -37716,11 +37865,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37716
37865
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37717
37866
|
const resolved = await resolveProfile(requested);
|
|
37718
37867
|
if (!resolved) {
|
|
37719
|
-
process.stderr.write(
|
|
37868
|
+
process.stderr.write(import_picocolors17.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37720
37869
|
process.exit(2);
|
|
37721
37870
|
}
|
|
37722
37871
|
if (resolved.autoSelected) {
|
|
37723
|
-
process.stderr.write(
|
|
37872
|
+
process.stderr.write(import_picocolors17.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37724
37873
|
`));
|
|
37725
37874
|
}
|
|
37726
37875
|
const { profile, name: profileName } = resolved;
|
|
@@ -37728,12 +37877,12 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37728
37877
|
const jsonMode = opts.json === true || !stdoutIsTty;
|
|
37729
37878
|
const amountNumber = Number(amount);
|
|
37730
37879
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37731
|
-
failArg4(`amount must be a positive number (got ${
|
|
37880
|
+
failArg4(`amount must be a positive number (got ${import_picocolors17.default.bold(amount)}).`);
|
|
37732
37881
|
}
|
|
37733
37882
|
const assetNorm = asset.toLowerCase();
|
|
37734
37883
|
if (!ASSET_VALUES2.has(assetNorm)) {
|
|
37735
37884
|
failArg4(
|
|
37736
|
-
`asset must be ${
|
|
37885
|
+
`asset must be ${import_picocolors17.default.bold("native")} or ${import_picocolors17.default.bold("usdc")} (got ${import_picocolors17.default.bold(asset)}).`
|
|
37737
37886
|
);
|
|
37738
37887
|
}
|
|
37739
37888
|
if (!opts.chain) {
|
|
@@ -37745,7 +37894,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37745
37894
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37746
37895
|
if (!PROTOCOLS.has(protocolNorm)) {
|
|
37747
37896
|
failArg4(
|
|
37748
|
-
`--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)}).`
|
|
37749
37898
|
);
|
|
37750
37899
|
}
|
|
37751
37900
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37797,11 +37946,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
37797
37946
|
}
|
|
37798
37947
|
|
|
37799
37948
|
// src/commands/earn-withdraw.ts
|
|
37800
|
-
var
|
|
37949
|
+
var import_picocolors18 = __toESM(require_picocolors(), 1);
|
|
37801
37950
|
var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
37802
37951
|
var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
37803
37952
|
function failArg5(msg) {
|
|
37804
|
-
process.stderr.write(
|
|
37953
|
+
process.stderr.write(import_picocolors18.default.red(`\u2715 ${msg}
|
|
37805
37954
|
`));
|
|
37806
37955
|
process.exit(2);
|
|
37807
37956
|
}
|
|
@@ -37809,11 +37958,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37809
37958
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
37810
37959
|
const resolved = await resolveProfile(requested);
|
|
37811
37960
|
if (!resolved) {
|
|
37812
|
-
process.stderr.write(
|
|
37961
|
+
process.stderr.write(import_picocolors18.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37813
37962
|
process.exit(2);
|
|
37814
37963
|
}
|
|
37815
37964
|
if (resolved.autoSelected) {
|
|
37816
|
-
process.stderr.write(
|
|
37965
|
+
process.stderr.write(import_picocolors18.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37817
37966
|
`));
|
|
37818
37967
|
}
|
|
37819
37968
|
const { profile, name: profileName } = resolved;
|
|
@@ -37824,14 +37973,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37824
37973
|
const amountNumber = Number(amountOrMax);
|
|
37825
37974
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
37826
37975
|
failArg5(
|
|
37827
|
-
`<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)}).`
|
|
37828
37977
|
);
|
|
37829
37978
|
}
|
|
37830
37979
|
}
|
|
37831
37980
|
const assetNorm = asset.toLowerCase();
|
|
37832
37981
|
if (!ASSET_VALUES3.has(assetNorm)) {
|
|
37833
37982
|
failArg5(
|
|
37834
|
-
`asset must be ${
|
|
37983
|
+
`asset must be ${import_picocolors18.default.bold("native")} or ${import_picocolors18.default.bold("usdc")} (got ${import_picocolors18.default.bold(asset)}).`
|
|
37835
37984
|
);
|
|
37836
37985
|
}
|
|
37837
37986
|
if (!opts.chain) {
|
|
@@ -37843,7 +37992,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37843
37992
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
37844
37993
|
if (!PROTOCOLS2.has(protocolNorm)) {
|
|
37845
37994
|
failArg5(
|
|
37846
|
-
`--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)}).`
|
|
37847
37996
|
);
|
|
37848
37997
|
}
|
|
37849
37998
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -37895,7 +38044,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
37895
38044
|
}
|
|
37896
38045
|
|
|
37897
38046
|
// src/commands/eat.ts
|
|
37898
|
-
var
|
|
38047
|
+
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
37899
38048
|
function parseLineJson(values) {
|
|
37900
38049
|
const lines = [];
|
|
37901
38050
|
for (const value of values) {
|
|
@@ -37922,11 +38071,11 @@ function parseLineJson(values) {
|
|
|
37922
38071
|
async function loadResolvedProfile(requested) {
|
|
37923
38072
|
const resolved = await resolveProfile(requested);
|
|
37924
38073
|
if (!resolved) {
|
|
37925
|
-
process.stderr.write(
|
|
38074
|
+
process.stderr.write(import_picocolors19.default.red("Not logged in. Run agentgates login first.\n"));
|
|
37926
38075
|
process.exit(2);
|
|
37927
38076
|
}
|
|
37928
38077
|
if (resolved.autoSelected) {
|
|
37929
|
-
process.stderr.write(
|
|
38078
|
+
process.stderr.write(import_picocolors19.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
37930
38079
|
`));
|
|
37931
38080
|
}
|
|
37932
38081
|
return resolved;
|
|
@@ -37937,12 +38086,12 @@ function printResult(res, jsonMode) {
|
|
|
37937
38086
|
return;
|
|
37938
38087
|
}
|
|
37939
38088
|
if (res.blocked) {
|
|
37940
|
-
process.stderr.write(
|
|
38089
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
|
|
37941
38090
|
`));
|
|
37942
38091
|
if (res.upgrade_url) {
|
|
37943
38092
|
process.stderr.write(
|
|
37944
38093
|
` Open this to grant access, then re-run the command:
|
|
37945
|
-
${
|
|
38094
|
+
${import_picocolors19.default.cyan(res.upgrade_url)}
|
|
37946
38095
|
`
|
|
37947
38096
|
);
|
|
37948
38097
|
}
|
|
@@ -37973,7 +38122,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
37973
38122
|
profile: resolved.profile,
|
|
37974
38123
|
profileName: resolved.name,
|
|
37975
38124
|
jsonMode,
|
|
37976
|
-
ttyHeader:
|
|
38125
|
+
ttyHeader: import_picocolors19.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
37977
38126
|
fn: (bearer, origin) => apiFetch(path5, { method: "POST", bearer, origin, body })
|
|
37978
38127
|
});
|
|
37979
38128
|
if (outcome.kind === "auth_failed") {
|
|
@@ -37983,7 +38132,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
37983
38132
|
);
|
|
37984
38133
|
process.exit(1);
|
|
37985
38134
|
}
|
|
37986
|
-
process.stderr.write(
|
|
38135
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${outcome.reason}.
|
|
37987
38136
|
`));
|
|
37988
38137
|
process.exit(1);
|
|
37989
38138
|
}
|
|
@@ -37996,7 +38145,7 @@ async function postRestaurant(path5, body, resolved, jsonMode) {
|
|
|
37996
38145
|
);
|
|
37997
38146
|
process.exit(1);
|
|
37998
38147
|
}
|
|
37999
|
-
process.stderr.write(
|
|
38148
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38000
38149
|
`));
|
|
38001
38150
|
process.exit(1);
|
|
38002
38151
|
}
|
|
@@ -38009,7 +38158,7 @@ async function searchFood(opts) {
|
|
|
38009
38158
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38010
38159
|
if (!opts.location && !opts.name) {
|
|
38011
38160
|
process.stderr.write(
|
|
38012
|
-
|
|
38161
|
+
import_picocolors19.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
|
|
38013
38162
|
);
|
|
38014
38163
|
process.exit(2);
|
|
38015
38164
|
}
|
|
@@ -38030,7 +38179,7 @@ async function menuFood(items, opts) {
|
|
|
38030
38179
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38031
38180
|
if (!opts.brand || !opts.address) {
|
|
38032
38181
|
process.stderr.write(
|
|
38033
|
-
|
|
38182
|
+
import_picocolors19.default.red(
|
|
38034
38183
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38035
38184
|
)
|
|
38036
38185
|
);
|
|
@@ -38050,7 +38199,7 @@ async function orderFood(items, opts) {
|
|
|
38050
38199
|
const jsonMode = opts.json === true || process.stdout.isTTY !== true;
|
|
38051
38200
|
if (!opts.brand || !opts.address) {
|
|
38052
38201
|
process.stderr.write(
|
|
38053
|
-
|
|
38202
|
+
import_picocolors19.default.red(
|
|
38054
38203
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
38055
38204
|
)
|
|
38056
38205
|
);
|
|
@@ -38060,14 +38209,14 @@ async function orderFood(items, opts) {
|
|
|
38060
38209
|
try {
|
|
38061
38210
|
structuredLines = parseLineJson(opts.lineJson ?? []);
|
|
38062
38211
|
} catch (e) {
|
|
38063
|
-
process.stderr.write(
|
|
38212
|
+
process.stderr.write(import_picocolors19.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
|
|
38064
38213
|
`));
|
|
38065
38214
|
process.exit(2);
|
|
38066
38215
|
}
|
|
38067
38216
|
const lines = [...items ?? [], ...structuredLines];
|
|
38068
38217
|
if (lines.length === 0) {
|
|
38069
38218
|
process.stderr.write(
|
|
38070
|
-
|
|
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")
|
|
38071
38220
|
);
|
|
38072
38221
|
process.exit(2);
|
|
38073
38222
|
}
|
|
@@ -38101,7 +38250,7 @@ async function orderFood(items, opts) {
|
|
|
38101
38250
|
if (!agentCard.will_attempt) {
|
|
38102
38251
|
if (!jsonMode) {
|
|
38103
38252
|
process.stderr.write(
|
|
38104
|
-
|
|
38253
|
+
import_picocolors19.default.yellow(
|
|
38105
38254
|
`This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
|
|
38106
38255
|
`
|
|
38107
38256
|
)
|
|
@@ -38118,7 +38267,7 @@ async function orderFood(items, opts) {
|
|
|
38118
38267
|
}
|
|
38119
38268
|
if (verdict.status === "paid") {
|
|
38120
38269
|
process.stdout.write(
|
|
38121
|
-
|
|
38270
|
+
import_picocolors19.default.green(
|
|
38122
38271
|
`Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
|
|
38123
38272
|
)
|
|
38124
38273
|
);
|
|
@@ -38126,7 +38275,7 @@ async function orderFood(items, opts) {
|
|
|
38126
38275
|
}
|
|
38127
38276
|
if (verdict.status === "failed") {
|
|
38128
38277
|
process.stderr.write(
|
|
38129
|
-
|
|
38278
|
+
import_picocolors19.default.yellow(
|
|
38130
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.
|
|
38131
38280
|
`
|
|
38132
38281
|
)
|
|
@@ -38136,7 +38285,7 @@ async function orderFood(items, opts) {
|
|
|
38136
38285
|
}
|
|
38137
38286
|
if (verdict.status === "unconfirmed") {
|
|
38138
38287
|
process.stderr.write(
|
|
38139
|
-
|
|
38288
|
+
import_picocolors19.default.red(
|
|
38140
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}
|
|
38141
38290
|
` : "")
|
|
38142
38291
|
)
|
|
@@ -38145,7 +38294,7 @@ async function orderFood(items, opts) {
|
|
|
38145
38294
|
return;
|
|
38146
38295
|
}
|
|
38147
38296
|
process.stderr.write(
|
|
38148
|
-
|
|
38297
|
+
import_picocolors19.default.dim(
|
|
38149
38298
|
`Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
|
|
38150
38299
|
)
|
|
38151
38300
|
);
|
|
@@ -38170,7 +38319,7 @@ var POLL_BUDGET_MS = 1e5;
|
|
|
38170
38319
|
var POLL_INTERVAL_MS2 = 3500;
|
|
38171
38320
|
async function pollOrderVerdict(orderId, resolved, jsonMode) {
|
|
38172
38321
|
if (!jsonMode) {
|
|
38173
|
-
process.stderr.write(
|
|
38322
|
+
process.stderr.write(import_picocolors19.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
|
|
38174
38323
|
}
|
|
38175
38324
|
const deadline = Date.now() + POLL_BUDGET_MS;
|
|
38176
38325
|
let last = {
|
|
@@ -38240,16 +38389,16 @@ async function statusFood(orderId, opts) {
|
|
|
38240
38389
|
}
|
|
38241
38390
|
|
|
38242
38391
|
// src/commands/bounties.ts
|
|
38243
|
-
var
|
|
38392
|
+
var import_picocolors20 = __toESM(require_picocolors(), 1);
|
|
38244
38393
|
async function withProfile(opts, path5, init) {
|
|
38245
38394
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38246
38395
|
const resolved = await resolveProfile(requested);
|
|
38247
38396
|
if (!resolved) {
|
|
38248
|
-
process.stderr.write(
|
|
38397
|
+
process.stderr.write(import_picocolors20.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38249
38398
|
process.exit(2);
|
|
38250
38399
|
}
|
|
38251
38400
|
if (resolved.autoSelected) {
|
|
38252
|
-
process.stderr.write(
|
|
38401
|
+
process.stderr.write(import_picocolors20.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38253
38402
|
`));
|
|
38254
38403
|
}
|
|
38255
38404
|
const { profile, name: profileName } = resolved;
|
|
@@ -38258,7 +38407,7 @@ async function withProfile(opts, path5, init) {
|
|
|
38258
38407
|
profile,
|
|
38259
38408
|
profileName,
|
|
38260
38409
|
jsonMode,
|
|
38261
|
-
ttyHeader:
|
|
38410
|
+
ttyHeader: import_picocolors20.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38262
38411
|
fn: (bearer, origin) => apiFetch(path5, init ? { bearer, origin, method: init.method, body: init.body } : { bearer, origin })
|
|
38263
38412
|
});
|
|
38264
38413
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38266,14 +38415,14 @@ async function withProfile(opts, path5, init) {
|
|
|
38266
38415
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38267
38416
|
process.exit(1);
|
|
38268
38417
|
}
|
|
38269
|
-
process.stderr.write(
|
|
38418
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${outcome.reason}.
|
|
38270
38419
|
`));
|
|
38271
38420
|
process.exit(1);
|
|
38272
38421
|
}
|
|
38273
38422
|
if (outcome.kind === "error") {
|
|
38274
38423
|
const err = outcome.error;
|
|
38275
38424
|
if (err instanceof ApiError) {
|
|
38276
|
-
process.stderr.write(
|
|
38425
|
+
process.stderr.write(import_picocolors20.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38277
38426
|
`));
|
|
38278
38427
|
process.exit(1);
|
|
38279
38428
|
}
|
|
@@ -38287,12 +38436,12 @@ function handleBlocked(res, jsonMode) {
|
|
|
38287
38436
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38288
38437
|
process.exit(1);
|
|
38289
38438
|
}
|
|
38290
|
-
process.stderr.write(
|
|
38439
|
+
process.stderr.write(import_picocolors20.default.yellow(`
|
|
38291
38440
|
${res.reason ?? "Blocked."}
|
|
38292
38441
|
`));
|
|
38293
38442
|
if (res.upgrade_url) {
|
|
38294
38443
|
process.stderr.write(`
|
|
38295
|
-
${
|
|
38444
|
+
${import_picocolors20.default.bold(res.upgrade_url)}
|
|
38296
38445
|
|
|
38297
38446
|
`);
|
|
38298
38447
|
}
|
|
@@ -38335,14 +38484,14 @@ function printTable(rows) {
|
|
|
38335
38484
|
const cLeft = w("left", 4);
|
|
38336
38485
|
const cSubs = w("subs", 4);
|
|
38337
38486
|
process.stdout.write(
|
|
38338
|
-
|
|
38487
|
+
import_picocolors20.default.dim(
|
|
38339
38488
|
"Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
|
|
38340
38489
|
) + "\n"
|
|
38341
38490
|
);
|
|
38342
38491
|
for (const c of cells) {
|
|
38343
|
-
const title = c.live ?
|
|
38492
|
+
const title = c.live ? import_picocolors20.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
|
|
38344
38493
|
process.stdout.write(
|
|
38345
|
-
|
|
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"
|
|
38346
38495
|
);
|
|
38347
38496
|
}
|
|
38348
38497
|
}
|
|
@@ -38354,11 +38503,11 @@ async function listBounties(opts) {
|
|
|
38354
38503
|
const min = opts.min !== void 0 ? Number(opts.min) : void 0;
|
|
38355
38504
|
const max = opts.max !== void 0 ? Number(opts.max) : void 0;
|
|
38356
38505
|
if (min !== void 0 && !Number.isFinite(min)) {
|
|
38357
|
-
process.stderr.write(
|
|
38506
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --min must be a number.\n"));
|
|
38358
38507
|
process.exit(2);
|
|
38359
38508
|
}
|
|
38360
38509
|
if (max !== void 0 && !Number.isFinite(max)) {
|
|
38361
|
-
process.stderr.write(
|
|
38510
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --max must be a number.\n"));
|
|
38362
38511
|
process.exit(2);
|
|
38363
38512
|
}
|
|
38364
38513
|
rows = rows.filter((r) => {
|
|
@@ -38383,7 +38532,7 @@ async function listBounties(opts) {
|
|
|
38383
38532
|
});
|
|
38384
38533
|
const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
|
|
38385
38534
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
38386
|
-
process.stderr.write(
|
|
38535
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --limit must be a positive number.\n"));
|
|
38387
38536
|
process.exit(2);
|
|
38388
38537
|
}
|
|
38389
38538
|
const shown = rows.slice(0, limit);
|
|
@@ -38392,13 +38541,13 @@ async function listBounties(opts) {
|
|
|
38392
38541
|
return;
|
|
38393
38542
|
}
|
|
38394
38543
|
if (shown.length === 0) {
|
|
38395
|
-
process.stdout.write(
|
|
38544
|
+
process.stdout.write(import_picocolors20.default.dim("No active bounties match.\n"));
|
|
38396
38545
|
return;
|
|
38397
38546
|
}
|
|
38398
38547
|
printTable(shown);
|
|
38399
38548
|
const clipped = rows.length - shown.length;
|
|
38400
38549
|
process.stdout.write(
|
|
38401
|
-
"\n" +
|
|
38550
|
+
"\n" + import_picocolors20.default.dim(
|
|
38402
38551
|
`${shown.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
|
|
38403
38552
|
`
|
|
38404
38553
|
)
|
|
@@ -38409,7 +38558,7 @@ async function showBounty(id, opts) {
|
|
|
38409
38558
|
const jsonMode = opts.json === true;
|
|
38410
38559
|
const clean = id.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
|
|
38411
38560
|
if (!clean) {
|
|
38412
|
-
process.stderr.write(
|
|
38561
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
|
|
38413
38562
|
process.exit(2);
|
|
38414
38563
|
}
|
|
38415
38564
|
const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean)}`);
|
|
@@ -38420,26 +38569,26 @@ async function showBounty(id, opts) {
|
|
|
38420
38569
|
}
|
|
38421
38570
|
const b = res.bounty;
|
|
38422
38571
|
if (!b) {
|
|
38423
|
-
process.stdout.write(
|
|
38572
|
+
process.stdout.write(import_picocolors20.default.dim("Not found.\n"));
|
|
38424
38573
|
return;
|
|
38425
38574
|
}
|
|
38426
|
-
process.stdout.write("\n" +
|
|
38575
|
+
process.stdout.write("\n" + import_picocolors20.default.bold(b.title) + "\n\n");
|
|
38427
38576
|
process.stdout.write(b.description + "\n\n");
|
|
38428
38577
|
process.stdout.write(
|
|
38429
|
-
|
|
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"
|
|
38430
38579
|
);
|
|
38431
38580
|
if (b.claimsAllowed && b.claimsAllowed > 1) {
|
|
38432
38581
|
const left = Math.max(0, b.claimsAllowed - (b.claimsPaid ?? 0));
|
|
38433
38582
|
process.stdout.write(
|
|
38434
|
-
|
|
38583
|
+
import_picocolors20.default.dim(
|
|
38435
38584
|
`${left} of ${b.claimsAllowed} claims left` + (b.perClaimAmount != null ? `, ${fmtAmount(b.perClaimAmount)} each` : "")
|
|
38436
38585
|
) + "\n"
|
|
38437
38586
|
);
|
|
38438
38587
|
}
|
|
38439
|
-
if (b.evidenceType) process.stdout.write(
|
|
38440
|
-
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");
|
|
38441
38590
|
if (b.geoLabel && b.geoScope !== "global") {
|
|
38442
|
-
process.stdout.write(
|
|
38591
|
+
process.stdout.write(import_picocolors20.default.dim(`Creator says: ${b.geoLabel}`) + "\n");
|
|
38443
38592
|
}
|
|
38444
38593
|
if (res.url) process.stdout.write("\n" + res.url + "\n");
|
|
38445
38594
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38457,7 +38606,7 @@ async function myBounties(opts) {
|
|
|
38457
38606
|
}
|
|
38458
38607
|
if (rows.length === 0) {
|
|
38459
38608
|
process.stdout.write(
|
|
38460
|
-
|
|
38609
|
+
import_picocolors20.default.dim(
|
|
38461
38610
|
status2 ? `No bounties of yours are ${status2}.
|
|
38462
38611
|
` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
|
|
38463
38612
|
)
|
|
@@ -38467,7 +38616,7 @@ async function myBounties(opts) {
|
|
|
38467
38616
|
printTable(rows);
|
|
38468
38617
|
const subs = res.submissions ?? [];
|
|
38469
38618
|
if (subs.length > 0) {
|
|
38470
|
-
process.stdout.write("\n" +
|
|
38619
|
+
process.stdout.write("\n" + import_picocolors20.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
|
|
38471
38620
|
`));
|
|
38472
38621
|
}
|
|
38473
38622
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -38486,19 +38635,19 @@ async function bountyFeed(opts) {
|
|
|
38486
38635
|
}
|
|
38487
38636
|
const subs = res.submissions ?? [];
|
|
38488
38637
|
if (subs.length === 0) {
|
|
38489
|
-
process.stdout.write(
|
|
38638
|
+
process.stdout.write(import_picocolors20.default.dim("Nothing in the feed for that filter.\n"));
|
|
38490
38639
|
return;
|
|
38491
38640
|
}
|
|
38492
38641
|
process.stdout.write(
|
|
38493
|
-
`${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"
|
|
38494
38643
|
);
|
|
38495
|
-
process.stdout.write(
|
|
38644
|
+
process.stdout.write(import_picocolors20.default.dim("Use --json for the full rows.\n"));
|
|
38496
38645
|
}
|
|
38497
38646
|
async function draftBounty(opts) {
|
|
38498
38647
|
const jsonMode = opts.json === true;
|
|
38499
38648
|
const amountNum = Number(opts.amount);
|
|
38500
38649
|
if (!Number.isFinite(amountNum) || amountNum <= 0) {
|
|
38501
|
-
process.stderr.write(
|
|
38650
|
+
process.stderr.write(import_picocolors20.default.red("\u2715 --amount must be a positive number of USDC.\n"));
|
|
38502
38651
|
process.exit(2);
|
|
38503
38652
|
}
|
|
38504
38653
|
const res = await withProfile(opts, "/api/bounties", {
|
|
@@ -38516,20 +38665,20 @@ async function draftBounty(opts) {
|
|
|
38516
38665
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
38517
38666
|
return;
|
|
38518
38667
|
}
|
|
38519
|
-
process.stdout.write("\n" +
|
|
38668
|
+
process.stdout.write("\n" + import_picocolors20.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
|
|
38520
38669
|
|
|
38521
38670
|
`);
|
|
38522
|
-
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"));
|
|
38523
38672
|
if (res.fund_url) {
|
|
38524
|
-
process.stdout.write("\nFund it here:\n" +
|
|
38525
|
-
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"));
|
|
38526
38675
|
}
|
|
38527
38676
|
}
|
|
38528
38677
|
|
|
38529
38678
|
// src/commands/bounty-money.ts
|
|
38530
|
-
var
|
|
38679
|
+
var import_picocolors21 = __toESM(require_picocolors(), 1);
|
|
38531
38680
|
function failArg6(message) {
|
|
38532
|
-
process.stderr.write(
|
|
38681
|
+
process.stderr.write(import_picocolors21.default.red(`${message}
|
|
38533
38682
|
`));
|
|
38534
38683
|
process.exit(2);
|
|
38535
38684
|
}
|
|
@@ -38541,12 +38690,12 @@ async function loadProfileOrExit(requested, jsonMode) {
|
|
|
38541
38690
|
JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
|
|
38542
38691
|
);
|
|
38543
38692
|
} else {
|
|
38544
|
-
process.stderr.write(
|
|
38693
|
+
process.stderr.write(import_picocolors21.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38545
38694
|
}
|
|
38546
38695
|
process.exit(2);
|
|
38547
38696
|
}
|
|
38548
38697
|
if (resolved.autoSelected && !jsonMode) {
|
|
38549
|
-
process.stderr.write(
|
|
38698
|
+
process.stderr.write(import_picocolors21.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38550
38699
|
`));
|
|
38551
38700
|
}
|
|
38552
38701
|
return { profile: resolved.profile, profileName: resolved.name };
|
|
@@ -38651,16 +38800,16 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
38651
38800
|
}
|
|
38652
38801
|
|
|
38653
38802
|
// src/commands/bounty-work.ts
|
|
38654
|
-
var
|
|
38803
|
+
var import_picocolors22 = __toESM(require_picocolors(), 1);
|
|
38655
38804
|
async function runWork(path5, body, opts) {
|
|
38656
38805
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38657
38806
|
const resolved = await resolveProfile(requested);
|
|
38658
38807
|
if (!resolved) {
|
|
38659
|
-
process.stderr.write(
|
|
38808
|
+
process.stderr.write(import_picocolors22.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38660
38809
|
process.exit(2);
|
|
38661
38810
|
}
|
|
38662
38811
|
if (resolved.autoSelected) {
|
|
38663
|
-
process.stderr.write(
|
|
38812
|
+
process.stderr.write(import_picocolors22.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38664
38813
|
`));
|
|
38665
38814
|
}
|
|
38666
38815
|
const jsonMode = opts.json === true;
|
|
@@ -38668,7 +38817,7 @@ async function runWork(path5, body, opts) {
|
|
|
38668
38817
|
profile: resolved.profile,
|
|
38669
38818
|
profileName: resolved.name,
|
|
38670
38819
|
jsonMode,
|
|
38671
|
-
ttyHeader:
|
|
38820
|
+
ttyHeader: import_picocolors22.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38672
38821
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38673
38822
|
});
|
|
38674
38823
|
if (outcome.kind === "auth_failed") {
|
|
@@ -38676,7 +38825,7 @@ async function runWork(path5, body, opts) {
|
|
|
38676
38825
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
38677
38826
|
process.exit(1);
|
|
38678
38827
|
}
|
|
38679
|
-
process.stderr.write(
|
|
38828
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${outcome.reason}.
|
|
38680
38829
|
`));
|
|
38681
38830
|
process.exit(1);
|
|
38682
38831
|
}
|
|
@@ -38686,7 +38835,7 @@ async function runWork(path5, body, opts) {
|
|
|
38686
38835
|
if (jsonMode) {
|
|
38687
38836
|
process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
|
|
38688
38837
|
} else {
|
|
38689
|
-
process.stderr.write(
|
|
38838
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
38690
38839
|
`));
|
|
38691
38840
|
}
|
|
38692
38841
|
process.exit(1);
|
|
@@ -38699,11 +38848,11 @@ async function runWork(path5, body, opts) {
|
|
|
38699
38848
|
process.stdout.write(JSON.stringify({ ok: false, ...data }) + "\n");
|
|
38700
38849
|
process.exit(1);
|
|
38701
38850
|
}
|
|
38702
|
-
process.stderr.write(
|
|
38851
|
+
process.stderr.write(import_picocolors22.default.yellow(`
|
|
38703
38852
|
${data.reason ?? "Blocked."}
|
|
38704
38853
|
`));
|
|
38705
38854
|
if (data.upgrade_url) process.stderr.write(`
|
|
38706
|
-
${
|
|
38855
|
+
${import_picocolors22.default.bold(data.upgrade_url)}
|
|
38707
38856
|
|
|
38708
38857
|
`);
|
|
38709
38858
|
process.exit(1);
|
|
@@ -38712,7 +38861,7 @@ ${import_picocolors21.default.bold(data.upgrade_url)}
|
|
|
38712
38861
|
if (jsonMode) {
|
|
38713
38862
|
process.stdout.write(JSON.stringify({ ok: false, error: data.error }) + "\n");
|
|
38714
38863
|
} else {
|
|
38715
|
-
process.stderr.write(
|
|
38864
|
+
process.stderr.write(import_picocolors22.default.red(`\u2715 ${data.error}
|
|
38716
38865
|
`));
|
|
38717
38866
|
}
|
|
38718
38867
|
process.exit(1);
|
|
@@ -38755,7 +38904,7 @@ async function bountyRetention(bountyId, opts) {
|
|
|
38755
38904
|
}
|
|
38756
38905
|
|
|
38757
38906
|
// src/commands/bounty-deliver.ts
|
|
38758
|
-
var
|
|
38907
|
+
var import_picocolors23 = __toESM(require_picocolors(), 1);
|
|
38759
38908
|
import { spawn } from "node:child_process";
|
|
38760
38909
|
var FLUSH_MS = 400;
|
|
38761
38910
|
var FLUSH_BYTES = 2048;
|
|
@@ -38764,11 +38913,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38764
38913
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
38765
38914
|
const resolved = await resolveProfile(requested);
|
|
38766
38915
|
if (!resolved) {
|
|
38767
|
-
process.stderr.write(
|
|
38916
|
+
process.stderr.write(import_picocolors23.default.red("Not logged in. Run agentgates login first.\n"));
|
|
38768
38917
|
process.exit(2);
|
|
38769
38918
|
}
|
|
38770
38919
|
if (resolved.autoSelected && !jsonMode) {
|
|
38771
|
-
process.stderr.write(
|
|
38920
|
+
process.stderr.write(import_picocolors23.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
38772
38921
|
`));
|
|
38773
38922
|
}
|
|
38774
38923
|
const post = async (path5, body) => {
|
|
@@ -38776,7 +38925,7 @@ async function deliver(bountyId, command, opts) {
|
|
|
38776
38925
|
profile: resolved.profile,
|
|
38777
38926
|
profileName: resolved.name,
|
|
38778
38927
|
jsonMode,
|
|
38779
|
-
ttyHeader:
|
|
38928
|
+
ttyHeader: import_picocolors23.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
38780
38929
|
fn: (bearer, origin) => apiFetch(path5, { bearer, origin, method: "POST", body })
|
|
38781
38930
|
});
|
|
38782
38931
|
if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
|
|
@@ -38787,11 +38936,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
38787
38936
|
if (jsonMode) {
|
|
38788
38937
|
process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data ?? {} }) + "\n");
|
|
38789
38938
|
} else {
|
|
38790
|
-
process.stderr.write(
|
|
38939
|
+
process.stderr.write(import_picocolors23.default.red(`
|
|
38791
38940
|
\u2715 ${msg}
|
|
38792
38941
|
`));
|
|
38793
38942
|
if (data?.upgrade_url) process.stderr.write(`
|
|
38794
|
-
${
|
|
38943
|
+
${import_picocolors23.default.bold(data.upgrade_url)}
|
|
38795
38944
|
|
|
38796
38945
|
`);
|
|
38797
38946
|
}
|
|
@@ -38816,7 +38965,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38816
38965
|
if (!runId) return void die("The service opened a run but did not name it.");
|
|
38817
38966
|
if (!jsonMode) {
|
|
38818
38967
|
process.stderr.write(
|
|
38819
|
-
|
|
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 ?? ""}
|
|
38820
38969
|
|
|
38821
38970
|
`)
|
|
38822
38971
|
);
|
|
@@ -38868,10 +39017,10 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38868
39017
|
child.stdout.on("data", (d) => consume(d));
|
|
38869
39018
|
child.stderr.setEncoding("utf8");
|
|
38870
39019
|
child.stderr.on("data", (d) => {
|
|
38871
|
-
if (!jsonMode) process.stderr.write(
|
|
39020
|
+
if (!jsonMode) process.stderr.write(import_picocolors23.default.dim(d));
|
|
38872
39021
|
});
|
|
38873
39022
|
child.on("error", (err) => {
|
|
38874
|
-
process.stderr.write(
|
|
39023
|
+
process.stderr.write(import_picocolors23.default.red(`
|
|
38875
39024
|
\u2715 Could not run ${command[0]}: ${err.message}
|
|
38876
39025
|
`));
|
|
38877
39026
|
resolve(127);
|
|
@@ -38908,14 +39057,14 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38908
39057
|
}
|
|
38909
39058
|
if (appendFailure) {
|
|
38910
39059
|
process.stderr.write(
|
|
38911
|
-
|
|
39060
|
+
import_picocolors23.default.yellow(`
|
|
38912
39061
|
! Some output did not reach the page: ${appendFailure}
|
|
38913
|
-
`) +
|
|
39062
|
+
`) + import_picocolors23.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
|
|
38914
39063
|
);
|
|
38915
39064
|
}
|
|
38916
39065
|
if (exitCode) {
|
|
38917
39066
|
process.stderr.write(
|
|
38918
|
-
|
|
39067
|
+
import_picocolors23.default.yellow(`
|
|
38919
39068
|
! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
|
|
38920
39069
|
`)
|
|
38921
39070
|
);
|
|
@@ -38925,7 +39074,7 @@ ${import_picocolors22.default.bold(data.upgrade_url)}
|
|
|
38925
39074
|
}
|
|
38926
39075
|
|
|
38927
39076
|
// src/commands/trade.ts
|
|
38928
|
-
var
|
|
39077
|
+
var import_picocolors24 = __toESM(require_picocolors(), 1);
|
|
38929
39078
|
|
|
38930
39079
|
// src/lib/trade-sol.ts
|
|
38931
39080
|
var import_web3 = __toESM(require_index_cjs(), 1);
|
|
@@ -39291,7 +39440,7 @@ function fail(message, json) {
|
|
|
39291
39440
|
if (json) {
|
|
39292
39441
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39293
39442
|
} else {
|
|
39294
|
-
process.stderr.write(
|
|
39443
|
+
process.stderr.write(import_picocolors24.default.red(`\u2715 ${message}
|
|
39295
39444
|
`));
|
|
39296
39445
|
}
|
|
39297
39446
|
process.exit(1);
|
|
@@ -39482,7 +39631,7 @@ async function tradeBuy(coinArg, amount, opts) {
|
|
|
39482
39631
|
}
|
|
39483
39632
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39484
39633
|
if (created && !opts.json) {
|
|
39485
|
-
process.stderr.write(
|
|
39634
|
+
process.stderr.write(import_picocolors24.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39486
39635
|
`));
|
|
39487
39636
|
}
|
|
39488
39637
|
const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
|
|
@@ -39536,7 +39685,7 @@ async function tradeOrderPlace(coinArg, opts) {
|
|
|
39536
39685
|
if (opts.mcap && !opts.at) fail("--mcap qualifies --at.", opts.json);
|
|
39537
39686
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
39538
39687
|
if (created && !opts.json) {
|
|
39539
|
-
process.stderr.write(
|
|
39688
|
+
process.stderr.write(import_picocolors24.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
39540
39689
|
`));
|
|
39541
39690
|
}
|
|
39542
39691
|
let amount;
|
|
@@ -39701,7 +39850,7 @@ async function tradePositions(opts) {
|
|
|
39701
39850
|
}
|
|
39702
39851
|
|
|
39703
39852
|
// src/commands/desk.ts
|
|
39704
|
-
var
|
|
39853
|
+
var import_picocolors25 = __toESM(require_picocolors(), 1);
|
|
39705
39854
|
|
|
39706
39855
|
// src/lib/desk-sol.ts
|
|
39707
39856
|
var import_web32 = __toESM(require_index_cjs(), 1);
|
|
@@ -39875,7 +40024,7 @@ function fail2(message, json) {
|
|
|
39875
40024
|
if (json) {
|
|
39876
40025
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
39877
40026
|
} else {
|
|
39878
|
-
process.stderr.write(
|
|
40027
|
+
process.stderr.write(import_picocolors25.default.red(`\u2715 ${message}
|
|
39879
40028
|
`));
|
|
39880
40029
|
}
|
|
39881
40030
|
process.exit(1);
|
|
@@ -40018,7 +40167,7 @@ async function deskDeposit(amount, opts) {
|
|
|
40018
40167
|
if (units <= 0n) fail2("Deposit amount must be above zero.", opts.json);
|
|
40019
40168
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
40020
40169
|
if (created && !opts.json) {
|
|
40021
|
-
process.stderr.write(
|
|
40170
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
40022
40171
|
`));
|
|
40023
40172
|
}
|
|
40024
40173
|
const result = await runDeskCeremony({
|
|
@@ -40113,13 +40262,13 @@ async function deskSessionRegister(opts) {
|
|
|
40113
40262
|
}
|
|
40114
40263
|
const owner = await loadOrCreateTradeKey();
|
|
40115
40264
|
if (owner.created && !opts.json) {
|
|
40116
|
-
process.stderr.write(
|
|
40265
|
+
process.stderr.write(import_picocolors25.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
|
|
40117
40266
|
`));
|
|
40118
40267
|
}
|
|
40119
40268
|
const session = await loadOrCreateDeskSessionKey();
|
|
40120
40269
|
if (session.created && !opts.json) {
|
|
40121
40270
|
process.stderr.write(
|
|
40122
|
-
|
|
40271
|
+
import_picocolors25.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
|
|
40123
40272
|
`)
|
|
40124
40273
|
);
|
|
40125
40274
|
}
|
|
@@ -40661,7 +40810,7 @@ program2.command("fund").description(
|
|
|
40661
40810
|
}
|
|
40662
40811
|
if (opts.usdc || opts.gas || opts.chain) {
|
|
40663
40812
|
process.stderr.write(
|
|
40664
|
-
|
|
40813
|
+
import_picocolors26.default.red(
|
|
40665
40814
|
`\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
|
|
40666
40815
|
`
|
|
40667
40816
|
)
|
|
@@ -40780,7 +40929,7 @@ desk.command("buy").description("Buy a launch coin with desk USDC credit (sessio
|
|
|
40780
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) => {
|
|
40781
40930
|
await deskSell(coin, amount, opts);
|
|
40782
40931
|
});
|
|
40783
|
-
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) => {
|
|
40784
40933
|
await onboard(opts);
|
|
40785
40934
|
});
|
|
40786
40935
|
var compute = program2.command("compute").description("Confidential virtual machines by the hour, USDC per payment");
|
|
@@ -40797,11 +40946,18 @@ inference.command("models").description("Live models and per-token prices. Publi
|
|
|
40797
40946
|
inference.command("ask").description("One paid ask (needs an x402 signature this CLI does not have yet)").action(async () => {
|
|
40798
40947
|
await inferenceAsk();
|
|
40799
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
|
+
});
|
|
40800
40956
|
program2.parseAsync(process.argv).catch((err) => {
|
|
40801
|
-
process.stderr.write(
|
|
40957
|
+
process.stderr.write(import_picocolors26.default.red(`\u2715 ${err.message}
|
|
40802
40958
|
`));
|
|
40803
40959
|
if (process.env.BOUNTY_DEBUG) {
|
|
40804
|
-
process.stderr.write(
|
|
40960
|
+
process.stderr.write(import_picocolors26.default.dim((err.stack ?? "") + "\n"));
|
|
40805
40961
|
}
|
|
40806
40962
|
process.exit(1);
|
|
40807
40963
|
});
|