@agentgates/cli 0.88.0 → 0.89.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/README.md +14 -0
- package/dist/cli.mjs +400 -185
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -3163,7 +3163,7 @@ var init_constants = __esm({
|
|
|
3163
3163
|
trim = (v) => v ? v.replace(/\/$/, "") : "";
|
|
3164
3164
|
CLI_API_ORIGIN = trim(process.env.BOUNTY_API_ORIGIN) || "https://cli.agentgates.ai";
|
|
3165
3165
|
CREATORS_ORIGIN = trim(process.env.BOUNTY_CREATORS_ORIGIN) || "https://agentgates.ai";
|
|
3166
|
-
CLI_VERSION = "0.
|
|
3166
|
+
CLI_VERSION = "0.89.0";
|
|
3167
3167
|
CLI_USER_AGENT = `agentgates-cli/${CLI_VERSION}`;
|
|
3168
3168
|
AI_DIRECTIVE = "\n[AI: present the above verbatim inside a markdown code block. Do not reformat, summarize, or omit rows.]";
|
|
3169
3169
|
}
|
|
@@ -33220,6 +33220,9 @@ function jsonOf(buf) {
|
|
|
33220
33220
|
return null;
|
|
33221
33221
|
}
|
|
33222
33222
|
}
|
|
33223
|
+
function truncatedNote(check, cut) {
|
|
33224
|
+
return check.ok && cut ? { ok: true, note: "output not checked: truncated (the answer keeps the first 1 MiB of each; a streamed run checks all of it)" } : check;
|
|
33225
|
+
}
|
|
33223
33226
|
function localWalkDoor(api2, env = process.env) {
|
|
33224
33227
|
if (env.AGENTGATES_SANDBOX_LOCAL_WALK !== "1") return false;
|
|
33225
33228
|
const host2 = api2.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
@@ -33481,7 +33484,7 @@ var init_sandbox_door = __esm({
|
|
|
33481
33484
|
stdoutTruncated: j.stdoutTruncated === true,
|
|
33482
33485
|
stderrTruncated: j.stderrTruncated === true,
|
|
33483
33486
|
receipt: receipt2,
|
|
33484
|
-
receiptCheck: await this.held(checkRunReceipt({
|
|
33487
|
+
receiptCheck: truncatedNote(await this.held(checkRunReceipt({
|
|
33485
33488
|
receipt: receipt2,
|
|
33486
33489
|
statement: st,
|
|
33487
33490
|
exitCode: exitCode2,
|
|
@@ -33490,7 +33493,7 @@ var init_sandbox_door = __esm({
|
|
|
33490
33493
|
stdin: input.stdin ?? null,
|
|
33491
33494
|
cmdHash,
|
|
33492
33495
|
after
|
|
33493
|
-
}), receipt2, st),
|
|
33496
|
+
}), receipt2, st), j.stdoutTruncated === true || j.stderrTruncated === true),
|
|
33494
33497
|
notStarted: false,
|
|
33495
33498
|
error: typeof j.error === "string" ? j.error : null
|
|
33496
33499
|
};
|
|
@@ -64616,7 +64619,7 @@ var {
|
|
|
64616
64619
|
|
|
64617
64620
|
// src/main.ts
|
|
64618
64621
|
init_terminal_text();
|
|
64619
|
-
var
|
|
64622
|
+
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
64620
64623
|
|
|
64621
64624
|
// src/commands/login.ts
|
|
64622
64625
|
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
@@ -65469,7 +65472,15 @@ ${opts.ttyHeader}
|
|
|
65469
65472
|
perTxUSD: approved.perTxUSD,
|
|
65470
65473
|
perDayUSD: approved.perDayUSD,
|
|
65471
65474
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
65472
|
-
mcpOrigin: origin
|
|
65475
|
+
mcpOrigin: origin,
|
|
65476
|
+
...Array.isArray(approved.wallets) ? {
|
|
65477
|
+
wallets: approved.wallets.map((w) => ({
|
|
65478
|
+
name: w.name,
|
|
65479
|
+
is_default: w.is_default,
|
|
65480
|
+
evm: w.evm,
|
|
65481
|
+
solana: w.solana ?? null
|
|
65482
|
+
}))
|
|
65483
|
+
} : {}
|
|
65473
65484
|
};
|
|
65474
65485
|
await saveProfile(profile, profileName);
|
|
65475
65486
|
if (!opts.jsonMode) {
|
|
@@ -65563,8 +65574,16 @@ Run ${import_picocolors2.default.bold(`agentgates logout --profile ${profileName
|
|
|
65563
65574
|
process.stdout.write(
|
|
65564
65575
|
` Wallet ${shortAddress(profile.walletAddress)}` + (profile.solanaAddress ? ` \xB7 ${shortAddress(profile.solanaAddress)}` : "") + "\n"
|
|
65565
65576
|
);
|
|
65566
|
-
|
|
65567
|
-
|
|
65577
|
+
const wallets2 = profile.wallets ?? [];
|
|
65578
|
+
if (wallets2.length > 1 || wallets2.length === 1 && !wallets2[0].is_default) {
|
|
65579
|
+
process.stdout.write(
|
|
65580
|
+
` Wallets ${wallets2.map((w) => w.is_default ? `${w.name} (default)` : w.name).join(", ")}
|
|
65581
|
+
`
|
|
65582
|
+
);
|
|
65583
|
+
}
|
|
65584
|
+
const scopes = profile.scopes.filter((s) => !s.startsWith("wallet:id:"));
|
|
65585
|
+
if (scopes.length > 0) {
|
|
65586
|
+
process.stdout.write(` Scopes ${scopes.join(", ")}
|
|
65568
65587
|
`);
|
|
65569
65588
|
}
|
|
65570
65589
|
const txCap = profile.perTxUSD == null ? "No limit/tx" : `$${profile.perTxUSD}/tx`;
|
|
@@ -66203,10 +66222,14 @@ var BACKOFF_MS = [2e3, 4e3, 8e3, 15e3, 3e4];
|
|
|
66203
66222
|
async function sendPaid(args) {
|
|
66204
66223
|
const attempts = Math.max(1, args.attempts ?? 6);
|
|
66205
66224
|
const sleep4 = args.sleep ?? ((ms) => new Promise((resolve5) => setTimeout(resolve5, ms)));
|
|
66225
|
+
const now = args.now ?? Date.now;
|
|
66226
|
+
const until = args.budgetMs !== void 0 ? now() + args.budgetMs : Infinity;
|
|
66206
66227
|
let last = null;
|
|
66207
66228
|
let why = "";
|
|
66229
|
+
let tried = 0;
|
|
66208
66230
|
for (let attempt = 1; attempt <= attempts; attempt += 1) {
|
|
66209
66231
|
let answer = null;
|
|
66232
|
+
tried = attempt;
|
|
66210
66233
|
try {
|
|
66211
66234
|
answer = await computeCall({
|
|
66212
66235
|
method: "POST",
|
|
@@ -66214,8 +66237,8 @@ async function sendPaid(args) {
|
|
|
66214
66237
|
body: args.body,
|
|
66215
66238
|
headers: { "x-payment": args.payment },
|
|
66216
66239
|
// A create waits for the chain, then the vendor: the API allows
|
|
66217
|
-
// itself 120 seconds.
|
|
66218
|
-
timeoutMs: args.timeoutMs ?? 15e4,
|
|
66240
|
+
// itself 120 seconds; within a budget, what is left of it.
|
|
66241
|
+
timeoutMs: Math.max(1e3, Math.min(args.timeoutMs ?? 15e4, until - now())),
|
|
66219
66242
|
fetchImpl: args.fetchImpl
|
|
66220
66243
|
});
|
|
66221
66244
|
} catch (err) {
|
|
@@ -66230,10 +66253,11 @@ async function sendPaid(args) {
|
|
|
66230
66253
|
}
|
|
66231
66254
|
if (attempt === attempts) break;
|
|
66232
66255
|
const waitMs = answer?.retryAfterSeconds ? Math.min(answer.retryAfterSeconds, 60) * 1e3 : BACKOFF_MS[Math.min(attempt - 1, BACKOFF_MS.length - 1)];
|
|
66256
|
+
if (now() + waitMs + 1e3 > until) break;
|
|
66233
66257
|
args.onRetry?.(why, attempt, waitMs);
|
|
66234
66258
|
await sleep4(waitMs);
|
|
66235
66259
|
}
|
|
66236
|
-
return { kind: "no_answer", error: why, attempts, last };
|
|
66260
|
+
return { kind: "no_answer", error: why, attempts: tried, last };
|
|
66237
66261
|
}
|
|
66238
66262
|
async function ownerGet(wallet, path12, opts = {}) {
|
|
66239
66263
|
const header2 = await ownerAuthHeader(wallet, "GET", path12);
|
|
@@ -66344,8 +66368,8 @@ async function computePlans(opts) {
|
|
|
66344
66368
|
const confidential = plans.filter((p) => p.proof !== "none" && !isSandbox(p));
|
|
66345
66369
|
const plain = plans.filter((p) => p.proof === "none" && !isSandbox(p));
|
|
66346
66370
|
const sections = [
|
|
66347
|
-
["CONFIDENTIAL VIRTUAL MACHINES", "memory encrypted in use", confidential],
|
|
66348
|
-
["PLAIN VIRTUAL MACHINES", "no proof
|
|
66371
|
+
["CONFIDENTIAL VIRTUAL MACHINES", "for agents that hold keys, money or private data: memory encrypted in use, a public proof", confidential],
|
|
66372
|
+
["PLAIN VIRTUAL MACHINES", "for agents with nothing secret, for much less: no proof, the host can read them", plain]
|
|
66349
66373
|
];
|
|
66350
66374
|
for (const [title, words7, list] of sections) {
|
|
66351
66375
|
if (list.length === 0) continue;
|
|
@@ -72165,10 +72189,10 @@ function html(res, status4, body) {
|
|
|
72165
72189
|
var esc = (s) => s.replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]);
|
|
72166
72190
|
var PAGE_STYLE = "body{margin:0;background:#101216;color:#f2f3f5;font:15px/1.5 ui-sans-serif,system-ui,sans-serif;display:grid;place-items:center;min-height:100vh}main{max-width:440px;padding:28px;border:1px solid rgba(255,255,255,.09);border-radius:16px;background:#1a1c21}h1{font-size:20px;margin:0 0 8px}p{color:rgba(242,243,245,.6);margin:8px 0}code{font-family:ui-monospace,Menlo,monospace;color:#fff}button{margin-top:14px;height:40px;padding:0 16px;border:0;border-radius:11px;background:#0891b2;color:#fff;font:inherit;font-weight:650;cursor:pointer}button:disabled{opacity:.5;cursor:default}.ok{color:#4ade80}";
|
|
72167
72191
|
function openPage(args) {
|
|
72168
|
-
const
|
|
72192
|
+
const short5 = `${args.address.slice(0, 6)}\u2026${args.address.slice(-4)}`;
|
|
72169
72193
|
const site = siteOpenUrl(args.origin, args.port, args.token);
|
|
72170
|
-
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agentgates \xB7 continue as ${esc(
|
|
72171
|
-
<h1>Continue as <code>${esc(
|
|
72194
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Agentgates \xB7 continue as ${esc(short5)}</title><style>${PAGE_STYLE}</style></head><body><main>
|
|
72195
|
+
<h1>Continue as <code>${esc(short5)}</code></h1>
|
|
72172
72196
|
<p>Your agent is handing you its session on agentgates.ai. Nothing leaves this machine: the words cross from this page to the site's window and nowhere else.</p>
|
|
72173
72197
|
<button id="go" type="button">Continue to agentgates.ai</button>
|
|
72174
72198
|
<p id="line"></p>
|
|
@@ -74639,7 +74663,7 @@ function printNext(put) {
|
|
|
74639
74663
|
`);
|
|
74640
74664
|
put(` ${import_picocolors12.default.dim("agentgates browser balance")} ${import_picocolors12.default.dim("\xB7 your balance and the address that tops it up")}
|
|
74641
74665
|
`);
|
|
74642
|
-
put(` ${import_picocolors12.default.dim("agentgates compute plans")} ${import_picocolors12.default.dim("\xB7
|
|
74666
|
+
put(` ${import_picocolors12.default.dim("agentgates compute plans")} ${import_picocolors12.default.dim("\xB7 computers for AI swarms, confidential or plain")}
|
|
74643
74667
|
`);
|
|
74644
74668
|
put(` ${import_picocolors12.default.dim("agentgates inference models")} ${import_picocolors12.default.dim("\xB7 models by the token")}
|
|
74645
74669
|
`);
|
|
@@ -74780,7 +74804,7 @@ var SandboxError = class extends Error {
|
|
|
74780
74804
|
code;
|
|
74781
74805
|
detail;
|
|
74782
74806
|
};
|
|
74783
|
-
var COLD_START_WORDS = "it waits for a seat on a host and runs once one has room: about two minutes after its payment when a host must start for it (135 s measured on production)";
|
|
74807
|
+
var COLD_START_WORDS = "it waits for a seat on a host and runs once one has room: about two minutes after its payment when a host must start for it (135 s measured on production), longer when many wait at once";
|
|
74784
74808
|
var KEY_RE = /^agc_[0-9a-f]{64}$/;
|
|
74785
74809
|
function computeKeyOf(given) {
|
|
74786
74810
|
const k = (given ?? process.env.AGENTGATES_COMPUTE_KEY ?? "").trim();
|
|
@@ -74845,15 +74869,31 @@ function microOfUsdText(raw) {
|
|
|
74845
74869
|
if (!m) throw new Error(`--max-usd takes dollars, like 1 or 0.5 (got "${raw}")`);
|
|
74846
74870
|
return BigInt(m[1]) * 1000000n + BigInt((m[2] ?? "").padEnd(6, "0"));
|
|
74847
74871
|
}
|
|
74872
|
+
function isSolLeg(leg) {
|
|
74873
|
+
return leg.extra?.token === "SOL";
|
|
74874
|
+
}
|
|
74848
74875
|
function legView2(leg) {
|
|
74849
74876
|
let amount = null;
|
|
74850
|
-
|
|
74851
|
-
|
|
74852
|
-
|
|
74853
|
-
|
|
74877
|
+
let amountSol = null;
|
|
74878
|
+
if (isSolLeg(leg)) {
|
|
74879
|
+
const said = leg.extra.usd;
|
|
74880
|
+
const dollars = typeof said === "string" || typeof said === "number" ? Number(said) : NaN;
|
|
74881
|
+
amount = Number.isFinite(dollars) ? `$${dollars.toFixed(3)}` : null;
|
|
74882
|
+
try {
|
|
74883
|
+
const v = BigInt(leg.maxAmountRequired ?? "");
|
|
74884
|
+
amountSol = `${v / 1000000000n}.${(v % 1000000000n).toString().padStart(9, "0")}`;
|
|
74885
|
+
} catch {
|
|
74886
|
+
amountSol = null;
|
|
74887
|
+
}
|
|
74888
|
+
} else {
|
|
74889
|
+
try {
|
|
74890
|
+
amount = leg.maxAmountRequired ? usd(BigInt(leg.maxAmountRequired)) : null;
|
|
74891
|
+
} catch {
|
|
74892
|
+
amount = null;
|
|
74893
|
+
}
|
|
74854
74894
|
}
|
|
74855
74895
|
const evm = evmLegs({ accepts: [leg] }).length > 0;
|
|
74856
|
-
return { network: leg.network ?? "?", amountUsd: amount, payTo: leg.payTo ?? null, asset: leg.asset ?? null, signsHere: evm };
|
|
74896
|
+
return { network: leg.network ?? "?", amountUsd: amount, ...amountSol !== null ? { amountSol } : {}, payTo: leg.payTo ?? null, asset: leg.asset ?? null, signsHere: evm };
|
|
74857
74897
|
}
|
|
74858
74898
|
async function payFor2(args) {
|
|
74859
74899
|
if (args.mode === "balance" || args.mode === "key") {
|
|
@@ -74865,7 +74905,7 @@ async function payFor2(args) {
|
|
|
74865
74905
|
}
|
|
74866
74906
|
if (ask.status !== 402) throw new SandboxError(apiWords2(ask), apiCode2(ask), { status: ask.status });
|
|
74867
74907
|
const offer2 = ask.json;
|
|
74868
|
-
const amounts = (offer2.accepts ?? []).map((l) => {
|
|
74908
|
+
const amounts = (offer2.accepts ?? []).filter((l) => !isSolLeg(l)).map((l) => {
|
|
74869
74909
|
try {
|
|
74870
74910
|
return BigInt(l.maxAmountRequired ?? "");
|
|
74871
74911
|
} catch {
|
|
@@ -74892,11 +74932,11 @@ async function payFor2(args) {
|
|
|
74892
74932
|
try {
|
|
74893
74933
|
answer = await computeCall({ method: "POST", url: args.url, body: args.body, headers, timeoutMs: 15e4 });
|
|
74894
74934
|
} catch (err) {
|
|
74895
|
-
throw new SandboxError(`the compute API did not answer: ${err.message}. A draw that went through shows in agentgates sandbox ls`, "no_answer");
|
|
74935
|
+
throw new SandboxError(`the compute API did not answer: ${err.message}. A draw that went through shows in agentgates sandbox ls${args.mode === "key" ? " --key <the same key>" : ""}`, "no_answer");
|
|
74896
74936
|
}
|
|
74897
74937
|
if (answer.status === 402) {
|
|
74898
|
-
const
|
|
74899
|
-
throw new SandboxError(`${
|
|
74938
|
+
const short5 = answer.json?.code === "insufficient_balance" || answer.json?.accepts ? "the balance does not cover it" : apiWords2(answer);
|
|
74939
|
+
throw new SandboxError(`${short5}: nothing was drawn. Pay over x402 instead (the same command without ${args.mode === "key" ? "--key" : "--from-balance"}), or top up the balance`, "insufficient_balance", { status: 402 });
|
|
74900
74940
|
}
|
|
74901
74941
|
if (answer.status < 200 || answer.status >= 300) throw new SandboxError(apiWords2(answer), apiCode2(answer), { status: answer.status });
|
|
74902
74942
|
const charged = answer.json?.charged?.amountMicro;
|
|
@@ -74957,9 +74997,10 @@ async function payFor2(args) {
|
|
|
74957
74997
|
const signed2 = await signLeg(leg, wallet.privateKey);
|
|
74958
74998
|
const paid = { network: leg.network, amountUsd: usd(leg.amountMicro), amountAtomic: leg.amountMicro.toString(), from: signed2.from, nonce: signed2.nonce };
|
|
74959
74999
|
args.onPaid?.(paid);
|
|
74960
|
-
const outcome = await sendPaid({ url: args.url, body: args.body, payment: signed2.header, onRetry: args.onRetry });
|
|
75000
|
+
const outcome = await sendPaid({ url: args.url, body: args.body, payment: signed2.header, onRetry: args.onRetry, ...args.budgetMs !== void 0 ? { budgetMs: args.budgetMs } : {} });
|
|
74961
75001
|
if (outcome.kind === "no_answer") {
|
|
74962
|
-
|
|
75002
|
+
const list = args.listWords ?? "agentgates sandbox ls";
|
|
75003
|
+
throw new SandboxError(`no clear answer after ${outcome.attempts} ${outcome.attempts === 1 ? "try" : "tries"} (${outcome.error}). The payment (nonce ${signed2.nonce}) may still settle: do not pay again; ${list} shows what it bought`, "no_answer", { paid, nonce: signed2.nonce });
|
|
74963
75004
|
}
|
|
74964
75005
|
if (outcome.kind === "refused") {
|
|
74965
75006
|
const a = outcome.answer;
|
|
@@ -74980,7 +75021,7 @@ async function createSandboxes(args) {
|
|
|
74980
75021
|
const count = typeof body.count === "number" ? body.count : 1;
|
|
74981
75022
|
const time = body.minutes !== void 0 ? `${String(body.minutes)} min` : `${String(body.hours)} h`;
|
|
74982
75023
|
const what = `${count > 1 ? `${count} x ` : ""}${String(body.plan)}, ${time}, ${typeof body.image === "string" ? body.image : "base"}`;
|
|
74983
|
-
const out = await payFor2({ url: `${computeOrigin()}${DEPLOYMENTS_PATH}`, path: DEPLOYMENTS_PATH, body, mode: args.mode, key: args.key, consent: args.consent, what, onPaid: args.onPaid, onRetry: args.onRetry });
|
|
75024
|
+
const out = await payFor2({ url: `${computeOrigin()}${DEPLOYMENTS_PATH}`, path: DEPLOYMENTS_PATH, body, mode: args.mode, key: args.key, consent: args.consent, what, onPaid: args.onPaid, onRetry: args.onRetry, budgetMs: args.budgetMs, listWords: args.listWords });
|
|
74984
75025
|
if (out.kind === "quote") return { quote: { description: out.description, legs: out.legs } };
|
|
74985
75026
|
const machines = machinesOf(out.answer.json);
|
|
74986
75027
|
const owner = args.mode === "key" ? null : out.payer;
|
|
@@ -75145,7 +75186,7 @@ async function renewSandbox(args) {
|
|
|
75145
75186
|
if (args.hours !== void 0) body.hours = n2;
|
|
75146
75187
|
else body.minutes = n2;
|
|
75147
75188
|
const what = `${n2} more ${args.hours !== void 0 ? "h" : "min"} on ${depId}`;
|
|
75148
|
-
return payFor2({ url: `${computeOrigin()}${path12}`, path: path12, body, mode: args.mode, key: args.key ?? null, consent: args.consent, what, onPaid: args.onPaid });
|
|
75189
|
+
return payFor2({ url: `${computeOrigin()}${path12}`, path: path12, body, mode: args.mode, key: args.key ?? null, consent: args.consent, what, onPaid: args.onPaid, budgetMs: args.budgetMs, listWords: args.listWords });
|
|
75149
75190
|
}
|
|
75150
75191
|
async function deleteSandbox(id2) {
|
|
75151
75192
|
const rec = await findRecord(id2);
|
|
@@ -75726,6 +75767,8 @@ async function sandboxExec(id2, argv, opts) {
|
|
|
75726
75767
|
process.exitCode = CLI_FAIL;
|
|
75727
75768
|
return;
|
|
75728
75769
|
}
|
|
75770
|
+
if (r.receiptCheck.note && !opts.json) sayErr2(` ${import_picocolors13.default.yellow("!")} receipt checked; ${r.receiptCheck.note}
|
|
75771
|
+
`);
|
|
75729
75772
|
if (r.timedOut) {
|
|
75730
75773
|
if (!opts.json) sayErr2(` ${import_picocolors13.default.yellow("!")} it ran out of its time${timeoutSeconds ? ` (${timeoutSeconds} s)` : " (300 s, the default)"}
|
|
75731
75774
|
`);
|
|
@@ -78075,12 +78118,13 @@ import { pipeline as pipeline2 } from "node:stream/promises";
|
|
|
78075
78118
|
init_sandbox_door();
|
|
78076
78119
|
var TEXT_MAX = 1e5;
|
|
78077
78120
|
var SANDBOX_INSTRUCTIONS = "`sandbox_create` buys a sealed sandbox, a small Linux computer for one agent in a confidential VM, by the minute; `sandbox_exec` runs a command in it, `sandbox_file_put` and `sandbox_file_get` move files and folders in and out, `sandbox_verify` checks its proof with a nonce of this machine's own. Every call goes straight to the sandbox, its proof checked first and every body sealed; every run comes back with a receipt checked here.";
|
|
78078
|
-
|
|
78121
|
+
var MCP_PAID_BUDGET_MS = 45e3;
|
|
78122
|
+
async function sandboxListing(env = process.env, fetchImpl = fetch) {
|
|
78079
78123
|
if (env.AGENTGATES_SANDBOX_TOOLS === "1") return true;
|
|
78080
78124
|
try {
|
|
78081
78125
|
return (await listedSandboxPlans(fetchImpl)).length > 0;
|
|
78082
78126
|
} catch {
|
|
78083
|
-
return
|
|
78127
|
+
return null;
|
|
78084
78128
|
}
|
|
78085
78129
|
}
|
|
78086
78130
|
function str(args, name) {
|
|
@@ -78153,7 +78197,10 @@ function sandboxTools() {
|
|
|
78153
78197
|
mode,
|
|
78154
78198
|
key,
|
|
78155
78199
|
accessKey: args.access_key === true,
|
|
78156
|
-
consent: { network: str(args, "network"), maxUsd: str(args, "max_usd"), interactive: false }
|
|
78200
|
+
consent: { network: str(args, "network"), maxUsd: str(args, "max_usd"), interactive: false },
|
|
78201
|
+
// Answered within an MCP client's 60 s (SESSION-4-GATE.md item 21).
|
|
78202
|
+
budgetMs: MCP_PAID_BUDGET_MS,
|
|
78203
|
+
listWords: "sandbox_list"
|
|
78157
78204
|
});
|
|
78158
78205
|
} catch (err) {
|
|
78159
78206
|
refused(err);
|
|
@@ -78357,7 +78404,7 @@ function sandboxTools() {
|
|
|
78357
78404
|
handler: async (args) => {
|
|
78358
78405
|
const { mode, key } = payOf(args);
|
|
78359
78406
|
try {
|
|
78360
|
-
const out = await renewSandbox({ id: need(args, "id", "the sandbox's id"), minutes: whole2(args, "minutes", 1, 720 * 60), mode, key, consent: { network: str(args, "network"), maxUsd: str(args, "max_usd"), interactive: false } });
|
|
78407
|
+
const out = await renewSandbox({ id: need(args, "id", "the sandbox's id"), minutes: whole2(args, "minutes", 1, 720 * 60), mode, key, consent: { network: str(args, "network"), maxUsd: str(args, "max_usd"), interactive: false }, budgetMs: MCP_PAID_BUDGET_MS, listWords: "sandbox_list" });
|
|
78361
78408
|
if (out.kind === "quote") throw new McpToolError("a quote was asked of a renewal");
|
|
78362
78409
|
return { ok: true, paid: out.paid, paidWith: out.mode, deployment: out.answer.json };
|
|
78363
78410
|
} catch (err) {
|
|
@@ -79052,26 +79099,40 @@ async function instructionsWithAbout() {
|
|
|
79052
79099
|
About the owner, in their own words (read when this server started; memory_about reads the current version):
|
|
79053
79100
|
${lines.map((l) => `- ${l}`).join("\n")}`;
|
|
79054
79101
|
}
|
|
79102
|
+
var LISTING_RETRY_MS = [2e3, 5e3, 15e3, 3e4];
|
|
79055
79103
|
async function mcpServeOn(io = {}, deps = {}) {
|
|
79056
79104
|
const env = deps.env ?? process.env;
|
|
79057
79105
|
const output2 = io.output ?? process.stdout;
|
|
79058
79106
|
const tools = mcpTools();
|
|
79059
79107
|
const forced = env.AGENTGATES_SANDBOX_TOOLS === "1";
|
|
79060
|
-
if (forced) tools.push(...sandboxTools());
|
|
79061
79108
|
let listedOnce = false;
|
|
79062
|
-
|
|
79063
|
-
|
|
79064
|
-
|
|
79065
|
-
|
|
79066
|
-
|
|
79109
|
+
const addSandboxTools = () => {
|
|
79110
|
+
if (tools.some((t) => t.name.startsWith("sandbox_"))) return false;
|
|
79111
|
+
tools.push(...sandboxTools());
|
|
79112
|
+
return true;
|
|
79113
|
+
};
|
|
79114
|
+
if (forced) addSandboxTools();
|
|
79115
|
+
const read = deps.listed ?? (() => sandboxListing(env));
|
|
79116
|
+
const retries = deps.retryMs ?? LISTING_RETRY_MS;
|
|
79117
|
+
const listing = forced ? Promise.resolve(true) : (async () => {
|
|
79118
|
+
for (let attempt = 0; ; attempt += 1) {
|
|
79119
|
+
const listed = await read().catch(() => null);
|
|
79120
|
+
if (listed !== null) return listed;
|
|
79121
|
+
if (attempt >= retries.length) return false;
|
|
79122
|
+
await new Promise((r) => setTimeout(r, retries[attempt]).unref());
|
|
79123
|
+
}
|
|
79124
|
+
})();
|
|
79125
|
+
void listing.then((listed) => {
|
|
79126
|
+
if (listed && addSandboxTools() && listedOnce) output2.write(`${JSON.stringify({ jsonrpc: "2.0", method: "notifications/tools/list_changed" })}
|
|
79067
79127
|
`);
|
|
79068
|
-
|
|
79069
|
-
|
|
79070
|
-
const instructions = await instructionsWithAbout();
|
|
79128
|
+
});
|
|
79129
|
+
const inTime = Promise.race([listing, new Promise((r) => setTimeout(() => r(null), deps.waitMs ?? ABOUT_AT_START_MS).unref())]);
|
|
79130
|
+
const [instructions, listedAtStart] = await Promise.all([instructionsWithAbout(), inTime]);
|
|
79131
|
+
if (listedAtStart) addSandboxTools();
|
|
79071
79132
|
await serve(tools, {
|
|
79072
79133
|
name: MCP_SERVER_NAME,
|
|
79073
79134
|
version: CLI_VERSION,
|
|
79074
|
-
instructions:
|
|
79135
|
+
instructions: listedAtStart ? `${instructions}
|
|
79075
79136
|
|
|
79076
79137
|
${SANDBOX_INSTRUCTIONS}` : instructions,
|
|
79077
79138
|
toolsChange: true,
|
|
@@ -81001,15 +81062,29 @@ async function whoami(opts) {
|
|
|
81001
81062
|
}
|
|
81002
81063
|
process.stdout.write(`User ${me.userId}
|
|
81003
81064
|
`);
|
|
81004
|
-
|
|
81005
|
-
|
|
81065
|
+
const wallets2 = me.wallets ?? [];
|
|
81066
|
+
const onlyDefault = wallets2.length === 0 || wallets2.length === 1 && wallets2[0].is_default;
|
|
81067
|
+
if (onlyDefault) {
|
|
81068
|
+
if (me.walletAddress) {
|
|
81069
|
+
process.stdout.write(`EVM ${me.walletAddress}
|
|
81006
81070
|
`);
|
|
81007
|
-
|
|
81008
|
-
|
|
81009
|
-
|
|
81071
|
+
}
|
|
81072
|
+
if (me.solanaAddress) {
|
|
81073
|
+
process.stdout.write(`Solana ${me.solanaAddress}
|
|
81010
81074
|
`);
|
|
81075
|
+
}
|
|
81076
|
+
} else {
|
|
81077
|
+
wallets2.forEach((w, i) => {
|
|
81078
|
+
process.stdout.write(`${i === 0 ? "Wallets " : " "} ${w.name}${w.is_default ? import_picocolors22.default.dim(" (default)") : ""}
|
|
81079
|
+
`);
|
|
81080
|
+
process.stdout.write(` EVM ${w.evm}
|
|
81081
|
+
`);
|
|
81082
|
+
if (w.solana) process.stdout.write(` Solana ${w.solana}
|
|
81083
|
+
`);
|
|
81084
|
+
});
|
|
81011
81085
|
}
|
|
81012
|
-
|
|
81086
|
+
const scopes = me.scopes.filter((s) => !s.startsWith("wallet:id:"));
|
|
81087
|
+
process.stdout.write(`Scopes ${scopes.join(", ") || import_picocolors22.default.dim("(none)")}
|
|
81013
81088
|
`);
|
|
81014
81089
|
const txCap = me.perTxUSD == null ? "No limit/tx" : `$${me.perTxUSD}/tx`;
|
|
81015
81090
|
const dayCap = me.perDayUSD == null ? "No limit/day" : `$${me.perDayUSD}/day`;
|
|
@@ -81301,7 +81376,8 @@ async function send(amount, asset, opts) {
|
|
|
81301
81376
|
amount,
|
|
81302
81377
|
asset: assetNormalized,
|
|
81303
81378
|
chain: opts.chain,
|
|
81304
|
-
user_stated: userStatedPayload
|
|
81379
|
+
user_stated: userStatedPayload,
|
|
81380
|
+
...opts.wallet ? { wallet: opts.wallet } : {}
|
|
81305
81381
|
};
|
|
81306
81382
|
let activeProfile = profile;
|
|
81307
81383
|
let proposed;
|
|
@@ -81405,6 +81481,12 @@ async function send(amount, asset, opts) {
|
|
|
81405
81481
|
process.stderr.write(import_picocolors23.default.red(`\u2715 ${proposed.reason}
|
|
81406
81482
|
`));
|
|
81407
81483
|
}
|
|
81484
|
+
if (proposed.code === "WALLET_NOT_GRANTED") {
|
|
81485
|
+
process.stderr.write(
|
|
81486
|
+
` To add it: ${import_picocolors23.default.bold("agentgates logout")}, then ${import_picocolors23.default.bold("agentgates login")}, and tick it on the page.
|
|
81487
|
+
`
|
|
81488
|
+
);
|
|
81489
|
+
}
|
|
81408
81490
|
if (proposed.upgrade_url) {
|
|
81409
81491
|
process.stderr.write(
|
|
81410
81492
|
` Open this to grant access, then re-run the command:
|
|
@@ -81454,15 +81536,16 @@ async function send(amount, asset, opts) {
|
|
|
81454
81536
|
preview: proposed.preview,
|
|
81455
81537
|
caps_snapshot: proposed.caps_snapshot,
|
|
81456
81538
|
price_snapshot: proposed.price_snapshot,
|
|
81457
|
-
balance_snapshot: proposed.balance_snapshot
|
|
81539
|
+
balance_snapshot: proposed.balance_snapshot,
|
|
81540
|
+
...proposed.wallet ? { wallet: proposed.wallet } : {}
|
|
81458
81541
|
});
|
|
81459
81542
|
} else {
|
|
81460
81543
|
process.stdout.write(
|
|
81461
81544
|
`
|
|
81462
81545
|
${import_picocolors23.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
81463
81546
|
${import_picocolors23.default.cyan(proposed.approval_url)}
|
|
81464
|
-
|
|
81465
|
-
`
|
|
81547
|
+
` + (proposed.wallet ? ` From ${import_picocolors23.default.bold(proposed.wallet.name)}
|
|
81548
|
+
` : "") + "\n"
|
|
81466
81549
|
);
|
|
81467
81550
|
}
|
|
81468
81551
|
if (shouldOpenBrowser) {
|
|
@@ -81835,7 +81918,10 @@ async function balance(opts) {
|
|
|
81835
81918
|
profileName,
|
|
81836
81919
|
jsonMode: jsonMode9,
|
|
81837
81920
|
ttyHeader: import_picocolors25.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
81838
|
-
fn: (bearer, origin) => apiFetch(
|
|
81921
|
+
fn: (bearer, origin) => apiFetch(
|
|
81922
|
+
opts.wallet ? `/api/balances?wallet=${encodeURIComponent(opts.wallet)}` : "/api/balances",
|
|
81923
|
+
{ bearer, origin }
|
|
81924
|
+
)
|
|
81839
81925
|
});
|
|
81840
81926
|
if (outcome.kind === "auth_failed") {
|
|
81841
81927
|
if (jsonMode9) {
|
|
@@ -81858,6 +81944,11 @@ async function balance(opts) {
|
|
|
81858
81944
|
throw err;
|
|
81859
81945
|
}
|
|
81860
81946
|
const res = outcome.result;
|
|
81947
|
+
if (res.code && res.error && !jsonMode9) {
|
|
81948
|
+
process.stderr.write(import_picocolors25.default.red(`\u2715 ${res.error}
|
|
81949
|
+
`));
|
|
81950
|
+
process.exit(1);
|
|
81951
|
+
}
|
|
81861
81952
|
const filtered = chainFilter !== null ? res.chains.filter((c) => c.chainId === chainFilter) : res.chains;
|
|
81862
81953
|
if (jsonMode9) {
|
|
81863
81954
|
process.stdout.write(
|
|
@@ -81867,8 +81958,10 @@ async function balance(opts) {
|
|
|
81867
81958
|
2
|
|
81868
81959
|
) + "\n"
|
|
81869
81960
|
);
|
|
81961
|
+
if (res.code && res.error) process.exit(1);
|
|
81870
81962
|
return;
|
|
81871
81963
|
}
|
|
81964
|
+
if (res.wallet) process.stdout.write(import_picocolors25.default.bold(res.wallet.name) + "\n");
|
|
81872
81965
|
if (res.snapshot && chainFilter === null) {
|
|
81873
81966
|
process.stdout.write(res.snapshot + "\n");
|
|
81874
81967
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -81994,7 +82087,7 @@ async function history(opts) {
|
|
|
81994
82087
|
jsonMode: jsonMode9,
|
|
81995
82088
|
ttyHeader: import_picocolors26.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
81996
82089
|
fn: (bearer, origin) => apiFetch(
|
|
81997
|
-
`/api/history?limit=${encodeURIComponent(String(limit))}
|
|
82090
|
+
`/api/history?limit=${encodeURIComponent(String(limit))}` + (opts.wallet ? `&wallet=${encodeURIComponent(opts.wallet)}` : ""),
|
|
81998
82091
|
{ bearer, origin }
|
|
81999
82092
|
)
|
|
82000
82093
|
});
|
|
@@ -82021,8 +82114,15 @@ async function history(opts) {
|
|
|
82021
82114
|
const res = outcome.result;
|
|
82022
82115
|
if (jsonMode9) {
|
|
82023
82116
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
82117
|
+
if (res.code && res.error) process.exit(1);
|
|
82024
82118
|
return;
|
|
82025
82119
|
}
|
|
82120
|
+
if (res.code && res.error) {
|
|
82121
|
+
process.stderr.write(import_picocolors26.default.red(`\u2715 ${res.error}
|
|
82122
|
+
`));
|
|
82123
|
+
process.exit(1);
|
|
82124
|
+
}
|
|
82125
|
+
if (res.wallet) process.stdout.write(import_picocolors26.default.bold(res.wallet.name) + "\n");
|
|
82026
82126
|
if (res.message && res.txs.length === 0) {
|
|
82027
82127
|
process.stdout.write(`${res.message}
|
|
82028
82128
|
`);
|
|
@@ -82207,6 +82307,9 @@ async function fetchTerminalDetail(intentId, profile) {
|
|
|
82207
82307
|
}
|
|
82208
82308
|
async function runIntentFlow(opts) {
|
|
82209
82309
|
let activeProfile = opts.initialProfile;
|
|
82310
|
+
if (opts.wallet && opts.body && typeof opts.body === "object") {
|
|
82311
|
+
opts = { ...opts, body: { ...opts.body, wallet: opts.wallet } };
|
|
82312
|
+
}
|
|
82210
82313
|
let proposed;
|
|
82211
82314
|
try {
|
|
82212
82315
|
proposed = await apiFetch(opts.endpoint, {
|
|
@@ -82299,6 +82402,12 @@ async function runIntentFlow(opts) {
|
|
|
82299
82402
|
}
|
|
82300
82403
|
process.stderr.write(import_picocolors27.default.red(`\u2715 Blocked (${proposed.code}): ${proposed.reason}
|
|
82301
82404
|
`));
|
|
82405
|
+
if (proposed.code === "WALLET_NOT_GRANTED") {
|
|
82406
|
+
process.stderr.write(
|
|
82407
|
+
` To add it: ${import_picocolors27.default.bold("agentgates logout")}, then ${import_picocolors27.default.bold("agentgates login")}, and tick it on the page.
|
|
82408
|
+
`
|
|
82409
|
+
);
|
|
82410
|
+
}
|
|
82302
82411
|
if (proposed.upgrade_url) {
|
|
82303
82412
|
process.stderr.write(
|
|
82304
82413
|
` Open this to grant access, then re-run the command:
|
|
@@ -82326,15 +82435,16 @@ async function runIntentFlow(opts) {
|
|
|
82326
82435
|
preview: proposed.preview,
|
|
82327
82436
|
caps_snapshot: proposed.caps_snapshot,
|
|
82328
82437
|
price_snapshot: proposed.price_snapshot,
|
|
82329
|
-
balance_snapshot: proposed.balance_snapshot
|
|
82438
|
+
balance_snapshot: proposed.balance_snapshot,
|
|
82439
|
+
...proposed.wallet ? { wallet: proposed.wallet } : {}
|
|
82330
82440
|
});
|
|
82331
82441
|
} else {
|
|
82332
82442
|
process.stdout.write(
|
|
82333
82443
|
`
|
|
82334
82444
|
${import_picocolors27.default.bold("Proposed.")} Open this URL to approve with biometric:
|
|
82335
82445
|
${import_picocolors27.default.cyan(proposed.approval_url)}
|
|
82336
|
-
|
|
82337
|
-
`
|
|
82446
|
+
` + (proposed.wallet ? ` From ${import_picocolors27.default.bold(proposed.wallet.name)}
|
|
82447
|
+
` : "") + "\n"
|
|
82338
82448
|
);
|
|
82339
82449
|
}
|
|
82340
82450
|
if (opts.shouldOpenBrowser) {
|
|
@@ -82672,6 +82782,7 @@ async function swap(amount, fromAsset, opts) {
|
|
|
82672
82782
|
return parts.join(" ");
|
|
82673
82783
|
};
|
|
82674
82784
|
await runIntentFlow({
|
|
82785
|
+
wallet: opts.wallet,
|
|
82675
82786
|
endpoint: "/api/intents/propose-swap",
|
|
82676
82787
|
body: proposeBody,
|
|
82677
82788
|
profileName,
|
|
@@ -82733,6 +82844,7 @@ async function batch(opts) {
|
|
|
82733
82844
|
};
|
|
82734
82845
|
const shouldOpenBrowser = resolveBrowserDefault(opts.browserMode ?? "auto");
|
|
82735
82846
|
await runIntentFlow({
|
|
82847
|
+
wallet: opts.wallet,
|
|
82736
82848
|
endpoint: "/api/intents/propose-batch",
|
|
82737
82849
|
body: {
|
|
82738
82850
|
legs,
|
|
@@ -82808,6 +82920,7 @@ async function fundWallet(address, opts) {
|
|
|
82808
82920
|
const shouldOpenBrowser = resolveBrowserDefault(opts.browserMode ?? "auto");
|
|
82809
82921
|
if (gas > 0 && usdc <= 0) {
|
|
82810
82922
|
await runIntentFlow({
|
|
82923
|
+
wallet: opts.wallet,
|
|
82811
82924
|
endpoint: "/api/intents/propose",
|
|
82812
82925
|
body: {
|
|
82813
82926
|
to: address,
|
|
@@ -82823,6 +82936,7 @@ async function fundWallet(address, opts) {
|
|
|
82823
82936
|
});
|
|
82824
82937
|
}
|
|
82825
82938
|
await runIntentFlow({
|
|
82939
|
+
wallet: opts.wallet,
|
|
82826
82940
|
endpoint: "/api/intents/propose-fund",
|
|
82827
82941
|
body: {
|
|
82828
82942
|
address,
|
|
@@ -82838,12 +82952,96 @@ async function fundWallet(address, opts) {
|
|
|
82838
82952
|
});
|
|
82839
82953
|
}
|
|
82840
82954
|
|
|
82841
|
-
// src/commands/
|
|
82955
|
+
// src/commands/wallets.ts
|
|
82842
82956
|
var import_picocolors31 = __toESM(require_picocolors(), 1);
|
|
82957
|
+
function short4(address) {
|
|
82958
|
+
return address.length > 12 ? `${address.slice(0, 6)}\u2026${address.slice(-4)}` : address;
|
|
82959
|
+
}
|
|
82960
|
+
async function wallets(opts) {
|
|
82961
|
+
const resolved = await resolveProfile(opts.profile ?? DEFAULT_PROFILE);
|
|
82962
|
+
if (!resolved) {
|
|
82963
|
+
process.stderr.write(import_picocolors31.default.red("Not logged in. Run agentgates login first.\n"));
|
|
82964
|
+
process.exit(2);
|
|
82965
|
+
}
|
|
82966
|
+
if (resolved.autoSelected) {
|
|
82967
|
+
process.stderr.write(import_picocolors31.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
82968
|
+
`));
|
|
82969
|
+
}
|
|
82970
|
+
const jsonMode9 = opts.json === true;
|
|
82971
|
+
const outcome = await callWithAutoRelogin({
|
|
82972
|
+
profile: resolved.profile,
|
|
82973
|
+
profileName: resolved.name,
|
|
82974
|
+
jsonMode: jsonMode9,
|
|
82975
|
+
ttyHeader: import_picocolors31.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
82976
|
+
fn: (bearer, origin) => apiFetch("/api/whoami", { bearer, origin })
|
|
82977
|
+
});
|
|
82978
|
+
if (outcome.kind === "auth_failed") {
|
|
82979
|
+
if (jsonMode9) {
|
|
82980
|
+
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
82981
|
+
process.exit(1);
|
|
82982
|
+
}
|
|
82983
|
+
process.stderr.write(import_picocolors31.default.red(`\u2715 ${outcome.reason}.
|
|
82984
|
+
`));
|
|
82985
|
+
process.exit(1);
|
|
82986
|
+
}
|
|
82987
|
+
if (outcome.kind === "error") {
|
|
82988
|
+
const err = outcome.error;
|
|
82989
|
+
if (err instanceof ApiError) {
|
|
82990
|
+
process.stderr.write(import_picocolors31.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
82991
|
+
`));
|
|
82992
|
+
process.exit(1);
|
|
82993
|
+
}
|
|
82994
|
+
throw err;
|
|
82995
|
+
}
|
|
82996
|
+
const list = outcome.result.wallets;
|
|
82997
|
+
if (!Array.isArray(list)) {
|
|
82998
|
+
if (jsonMode9) {
|
|
82999
|
+
process.stdout.write(JSON.stringify({ ok: false, error: "The server did not list this terminal's wallets." }) + "\n");
|
|
83000
|
+
process.exit(1);
|
|
83001
|
+
}
|
|
83002
|
+
process.stderr.write(import_picocolors31.default.red("\u2715 The server did not list this terminal's wallets. Try again in a minute.\n"));
|
|
83003
|
+
process.exit(1);
|
|
83004
|
+
}
|
|
83005
|
+
if (jsonMode9) {
|
|
83006
|
+
process.stdout.write(JSON.stringify({ wallets: list }, null, 2) + "\n");
|
|
83007
|
+
return;
|
|
83008
|
+
}
|
|
83009
|
+
if (list.length === 0) {
|
|
83010
|
+
process.stdout.write("No wallet on this account yet. Create one at agentgates.ai.\n");
|
|
83011
|
+
return;
|
|
83012
|
+
}
|
|
83013
|
+
const width = Math.max(...list.map((w) => w.name.length + (w.is_default ? 10 : 0)));
|
|
83014
|
+
for (const w of list) {
|
|
83015
|
+
const label = w.is_default ? `${w.name} (default)` : w.name;
|
|
83016
|
+
process.stdout.write(
|
|
83017
|
+
`${label.padEnd(width)} ${short4(w.evm)}${w.solana ? ` ${short4(w.solana)}` : ""}
|
|
83018
|
+
`
|
|
83019
|
+
);
|
|
83020
|
+
}
|
|
83021
|
+
const fallback = list.find((w) => w.is_default) ?? (list.length === 1 ? list[0] : null);
|
|
83022
|
+
if (list.length > 1) {
|
|
83023
|
+
process.stdout.write(
|
|
83024
|
+
import_picocolors31.default.dim(
|
|
83025
|
+
fallback ? `
|
|
83026
|
+
Pick one with --wallet "<name>"; without it, ${fallback.name} pays.
|
|
83027
|
+
` : `
|
|
83028
|
+
Name one with --wallet "<name>" on every call.
|
|
83029
|
+
`
|
|
83030
|
+
)
|
|
83031
|
+
);
|
|
83032
|
+
} else if (!list[0].is_default) {
|
|
83033
|
+
process.stdout.write(import_picocolors31.default.dim(`
|
|
83034
|
+
This terminal pays from ${list[0].name}.
|
|
83035
|
+
`));
|
|
83036
|
+
}
|
|
83037
|
+
}
|
|
83038
|
+
|
|
83039
|
+
// src/commands/earn-supply.ts
|
|
83040
|
+
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
82843
83041
|
var ASSET_VALUES2 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
82844
83042
|
var PROTOCOLS = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
82845
83043
|
function failArg4(msg) {
|
|
82846
|
-
process.stderr.write(
|
|
83044
|
+
process.stderr.write(import_picocolors32.default.red(`\u2715 ${msg}
|
|
82847
83045
|
`));
|
|
82848
83046
|
process.exit(2);
|
|
82849
83047
|
}
|
|
@@ -82851,11 +83049,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
82851
83049
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
82852
83050
|
const resolved = await resolveProfile(requested);
|
|
82853
83051
|
if (!resolved) {
|
|
82854
|
-
process.stderr.write(
|
|
83052
|
+
process.stderr.write(import_picocolors32.default.red("Not logged in. Run agentgates login first.\n"));
|
|
82855
83053
|
process.exit(2);
|
|
82856
83054
|
}
|
|
82857
83055
|
if (resolved.autoSelected) {
|
|
82858
|
-
process.stderr.write(
|
|
83056
|
+
process.stderr.write(import_picocolors32.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
82859
83057
|
`));
|
|
82860
83058
|
}
|
|
82861
83059
|
const { profile, name: profileName } = resolved;
|
|
@@ -82863,12 +83061,12 @@ async function earnSupply(amount, asset, opts) {
|
|
|
82863
83061
|
const jsonMode9 = opts.json === true || !stdoutIsTty;
|
|
82864
83062
|
const amountNumber = Number(amount);
|
|
82865
83063
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
82866
|
-
failArg4(`amount must be a positive number (got ${
|
|
83064
|
+
failArg4(`amount must be a positive number (got ${import_picocolors32.default.bold(amount)}).`);
|
|
82867
83065
|
}
|
|
82868
83066
|
const assetNorm = asset.toLowerCase();
|
|
82869
83067
|
if (!ASSET_VALUES2.has(assetNorm)) {
|
|
82870
83068
|
failArg4(
|
|
82871
|
-
`asset must be ${
|
|
83069
|
+
`asset must be ${import_picocolors32.default.bold("native")} or ${import_picocolors32.default.bold("usdc")} (got ${import_picocolors32.default.bold(asset)}).`
|
|
82872
83070
|
);
|
|
82873
83071
|
}
|
|
82874
83072
|
if (!opts.chain) {
|
|
@@ -82880,7 +83078,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
82880
83078
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
82881
83079
|
if (!PROTOCOLS.has(protocolNorm)) {
|
|
82882
83080
|
failArg4(
|
|
82883
|
-
`--protocol must be ${
|
|
83081
|
+
`--protocol must be ${import_picocolors32.default.bold("aave_v3")} or ${import_picocolors32.default.bold("kamino_lend")} (got ${import_picocolors32.default.bold(opts.protocol)}).`
|
|
82884
83082
|
);
|
|
82885
83083
|
}
|
|
82886
83084
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -82922,6 +83120,7 @@ async function earnSupply(amount, asset, opts) {
|
|
|
82922
83120
|
};
|
|
82923
83121
|
const shouldOpenBrowser = resolveBrowserDefault(opts.browserMode ?? "auto");
|
|
82924
83122
|
await runIntentFlow({
|
|
83123
|
+
wallet: opts.wallet,
|
|
82925
83124
|
endpoint: "/api/intents/propose-earn-supply",
|
|
82926
83125
|
body: proposeBody,
|
|
82927
83126
|
profileName,
|
|
@@ -82932,11 +83131,11 @@ async function earnSupply(amount, asset, opts) {
|
|
|
82932
83131
|
}
|
|
82933
83132
|
|
|
82934
83133
|
// src/commands/earn-withdraw.ts
|
|
82935
|
-
var
|
|
83134
|
+
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
82936
83135
|
var ASSET_VALUES3 = /* @__PURE__ */ new Set(["native", "usdc"]);
|
|
82937
83136
|
var PROTOCOLS2 = /* @__PURE__ */ new Set(["aave_v3", "kamino_lend"]);
|
|
82938
83137
|
function failArg5(msg) {
|
|
82939
|
-
process.stderr.write(
|
|
83138
|
+
process.stderr.write(import_picocolors33.default.red(`\u2715 ${msg}
|
|
82940
83139
|
`));
|
|
82941
83140
|
process.exit(2);
|
|
82942
83141
|
}
|
|
@@ -82944,11 +83143,11 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
82944
83143
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
82945
83144
|
const resolved = await resolveProfile(requested);
|
|
82946
83145
|
if (!resolved) {
|
|
82947
|
-
process.stderr.write(
|
|
83146
|
+
process.stderr.write(import_picocolors33.default.red("Not logged in. Run agentgates login first.\n"));
|
|
82948
83147
|
process.exit(2);
|
|
82949
83148
|
}
|
|
82950
83149
|
if (resolved.autoSelected) {
|
|
82951
|
-
process.stderr.write(
|
|
83150
|
+
process.stderr.write(import_picocolors33.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
82952
83151
|
`));
|
|
82953
83152
|
}
|
|
82954
83153
|
const { profile, name: profileName } = resolved;
|
|
@@ -82959,14 +83158,14 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
82959
83158
|
const amountNumber = Number(amountOrMax);
|
|
82960
83159
|
if (!Number.isFinite(amountNumber) || amountNumber <= 0) {
|
|
82961
83160
|
failArg5(
|
|
82962
|
-
`<amount-or-max> must be a positive number or the literal string "max" (got ${
|
|
83161
|
+
`<amount-or-max> must be a positive number or the literal string "max" (got ${import_picocolors33.default.bold(amountOrMax)}).`
|
|
82963
83162
|
);
|
|
82964
83163
|
}
|
|
82965
83164
|
}
|
|
82966
83165
|
const assetNorm = asset.toLowerCase();
|
|
82967
83166
|
if (!ASSET_VALUES3.has(assetNorm)) {
|
|
82968
83167
|
failArg5(
|
|
82969
|
-
`asset must be ${
|
|
83168
|
+
`asset must be ${import_picocolors33.default.bold("native")} or ${import_picocolors33.default.bold("usdc")} (got ${import_picocolors33.default.bold(asset)}).`
|
|
82970
83169
|
);
|
|
82971
83170
|
}
|
|
82972
83171
|
if (!opts.chain) {
|
|
@@ -82978,7 +83177,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
82978
83177
|
const protocolNorm = opts.protocol.toLowerCase();
|
|
82979
83178
|
if (!PROTOCOLS2.has(protocolNorm)) {
|
|
82980
83179
|
failArg5(
|
|
82981
|
-
`--protocol must be ${
|
|
83180
|
+
`--protocol must be ${import_picocolors33.default.bold("aave_v3")} or ${import_picocolors33.default.bold("kamino_lend")} (got ${import_picocolors33.default.bold(opts.protocol)}).`
|
|
82982
83181
|
);
|
|
82983
83182
|
}
|
|
82984
83183
|
if (!opts.userStated || opts.userStated.trim() === "") {
|
|
@@ -83020,6 +83219,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
83020
83219
|
};
|
|
83021
83220
|
const shouldOpenBrowser = resolveBrowserDefault(opts.browserMode ?? "auto");
|
|
83022
83221
|
await runIntentFlow({
|
|
83222
|
+
wallet: opts.wallet,
|
|
83023
83223
|
endpoint: "/api/intents/propose-earn-withdraw",
|
|
83024
83224
|
body: proposeBody,
|
|
83025
83225
|
profileName,
|
|
@@ -83030,7 +83230,7 @@ async function earnWithdraw(amountOrMax, asset, opts) {
|
|
|
83030
83230
|
}
|
|
83031
83231
|
|
|
83032
83232
|
// src/commands/eat.ts
|
|
83033
|
-
var
|
|
83233
|
+
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
83034
83234
|
function parseLineJson(values) {
|
|
83035
83235
|
const lines = [];
|
|
83036
83236
|
for (const value of values) {
|
|
@@ -83057,11 +83257,11 @@ function parseLineJson(values) {
|
|
|
83057
83257
|
async function loadResolvedProfile(requested) {
|
|
83058
83258
|
const resolved = await resolveProfile(requested);
|
|
83059
83259
|
if (!resolved) {
|
|
83060
|
-
process.stderr.write(
|
|
83260
|
+
process.stderr.write(import_picocolors34.default.red("Not logged in. Run agentgates login first.\n"));
|
|
83061
83261
|
process.exit(2);
|
|
83062
83262
|
}
|
|
83063
83263
|
if (resolved.autoSelected) {
|
|
83064
|
-
process.stderr.write(
|
|
83264
|
+
process.stderr.write(import_picocolors34.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
83065
83265
|
`));
|
|
83066
83266
|
}
|
|
83067
83267
|
return resolved;
|
|
@@ -83072,12 +83272,12 @@ function printResult(res, jsonMode9) {
|
|
|
83072
83272
|
return;
|
|
83073
83273
|
}
|
|
83074
83274
|
if (res.blocked) {
|
|
83075
|
-
process.stderr.write(
|
|
83275
|
+
process.stderr.write(import_picocolors34.default.red(`\u2715 ${res.reason ?? res.code ?? "Blocked"}
|
|
83076
83276
|
`));
|
|
83077
83277
|
if (res.upgrade_url) {
|
|
83078
83278
|
process.stderr.write(
|
|
83079
83279
|
` Open this to grant access, then re-run the command:
|
|
83080
|
-
${
|
|
83280
|
+
${import_picocolors34.default.cyan(res.upgrade_url)}
|
|
83081
83281
|
`
|
|
83082
83282
|
);
|
|
83083
83283
|
}
|
|
@@ -83108,7 +83308,7 @@ async function postRestaurant(path12, body, resolved, jsonMode9) {
|
|
|
83108
83308
|
profile: resolved.profile,
|
|
83109
83309
|
profileName: resolved.name,
|
|
83110
83310
|
jsonMode: jsonMode9,
|
|
83111
|
-
ttyHeader:
|
|
83311
|
+
ttyHeader: import_picocolors34.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
83112
83312
|
fn: (bearer, origin) => apiFetch(path12, { method: "POST", bearer, origin, body })
|
|
83113
83313
|
});
|
|
83114
83314
|
if (outcome.kind === "auth_failed") {
|
|
@@ -83118,7 +83318,7 @@ async function postRestaurant(path12, body, resolved, jsonMode9) {
|
|
|
83118
83318
|
);
|
|
83119
83319
|
process.exit(1);
|
|
83120
83320
|
}
|
|
83121
|
-
process.stderr.write(
|
|
83321
|
+
process.stderr.write(import_picocolors34.default.red(`\u2715 ${outcome.reason}.
|
|
83122
83322
|
`));
|
|
83123
83323
|
process.exit(1);
|
|
83124
83324
|
}
|
|
@@ -83131,7 +83331,7 @@ async function postRestaurant(path12, body, resolved, jsonMode9) {
|
|
|
83131
83331
|
);
|
|
83132
83332
|
process.exit(1);
|
|
83133
83333
|
}
|
|
83134
|
-
process.stderr.write(
|
|
83334
|
+
process.stderr.write(import_picocolors34.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
83135
83335
|
`));
|
|
83136
83336
|
process.exit(1);
|
|
83137
83337
|
}
|
|
@@ -83144,7 +83344,7 @@ async function searchFood(opts) {
|
|
|
83144
83344
|
const jsonMode9 = opts.json === true || process.stdout.isTTY !== true;
|
|
83145
83345
|
if (!opts.location && !opts.name) {
|
|
83146
83346
|
process.stderr.write(
|
|
83147
|
-
|
|
83347
|
+
import_picocolors34.default.red("\u2715 Pass --location (search near a place) or --name (look one store up).\n")
|
|
83148
83348
|
);
|
|
83149
83349
|
process.exit(2);
|
|
83150
83350
|
}
|
|
@@ -83165,7 +83365,7 @@ async function menuFood(items, opts) {
|
|
|
83165
83365
|
const jsonMode9 = opts.json === true || process.stdout.isTTY !== true;
|
|
83166
83366
|
if (!opts.brand || !opts.address) {
|
|
83167
83367
|
process.stderr.write(
|
|
83168
|
-
|
|
83368
|
+
import_picocolors34.default.red(
|
|
83169
83369
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
83170
83370
|
)
|
|
83171
83371
|
);
|
|
@@ -83185,7 +83385,7 @@ async function orderFood(items, opts) {
|
|
|
83185
83385
|
const jsonMode9 = opts.json === true || process.stdout.isTTY !== true;
|
|
83186
83386
|
if (!opts.brand || !opts.address) {
|
|
83187
83387
|
process.stderr.write(
|
|
83188
|
-
|
|
83388
|
+
import_picocolors34.default.red(
|
|
83189
83389
|
"\u2715 --brand and --address are required \u2014 use the pair a `agentgates eat search` result gave you, verbatim.\n"
|
|
83190
83390
|
)
|
|
83191
83391
|
);
|
|
@@ -83195,14 +83395,14 @@ async function orderFood(items, opts) {
|
|
|
83195
83395
|
try {
|
|
83196
83396
|
structuredLines = parseLineJson(opts.lineJson ?? []);
|
|
83197
83397
|
} catch (e) {
|
|
83198
|
-
process.stderr.write(
|
|
83398
|
+
process.stderr.write(import_picocolors34.default.red(`\u2715 ${e instanceof Error ? e.message : String(e)}
|
|
83199
83399
|
`));
|
|
83200
83400
|
process.exit(2);
|
|
83201
83401
|
}
|
|
83202
83402
|
const lines = [...items ?? [], ...structuredLines];
|
|
83203
83403
|
if (lines.length === 0) {
|
|
83204
83404
|
process.stderr.write(
|
|
83205
|
-
|
|
83405
|
+
import_picocolors34.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")
|
|
83206
83406
|
);
|
|
83207
83407
|
process.exit(2);
|
|
83208
83408
|
}
|
|
@@ -83236,7 +83436,7 @@ async function orderFood(items, opts) {
|
|
|
83236
83436
|
if (!agentCard.will_attempt) {
|
|
83237
83437
|
if (!jsonMode9) {
|
|
83238
83438
|
process.stderr.write(
|
|
83239
|
-
|
|
83439
|
+
import_picocolors34.default.yellow(
|
|
83240
83440
|
agentCard.allowed ? `This order is over your saved card's per-order cap (${fmtCents(agentCard.max_per_order_cents)}), so it needs you.
|
|
83241
83441
|
` : `You have not allowed this login to pay for food with your saved card, so it needs you. Allow "Pay for food" on this agent's page in your Agentgates wallet to let it pay the next ones.
|
|
83242
83442
|
`
|
|
@@ -83254,7 +83454,7 @@ async function orderFood(items, opts) {
|
|
|
83254
83454
|
}
|
|
83255
83455
|
if (verdict.status === "paid") {
|
|
83256
83456
|
process.stdout.write(
|
|
83257
|
-
|
|
83457
|
+
import_picocolors34.default.green(
|
|
83258
83458
|
`Paid with your saved card ending ${agentCard.last4}.` + (verdict.failure_detail ? ` ${verdict.failure_detail}` : "") + " Nothing to do.\n"
|
|
83259
83459
|
)
|
|
83260
83460
|
);
|
|
@@ -83262,7 +83462,7 @@ async function orderFood(items, opts) {
|
|
|
83262
83462
|
}
|
|
83263
83463
|
if (verdict.status === "failed") {
|
|
83264
83464
|
process.stderr.write(
|
|
83265
|
-
|
|
83465
|
+
import_picocolors34.default.yellow(
|
|
83266
83466
|
`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.
|
|
83267
83467
|
`
|
|
83268
83468
|
)
|
|
@@ -83272,7 +83472,7 @@ async function orderFood(items, opts) {
|
|
|
83272
83472
|
}
|
|
83273
83473
|
if (verdict.status === "unconfirmed") {
|
|
83274
83474
|
process.stderr.write(
|
|
83275
|
-
|
|
83475
|
+
import_picocolors34.default.red(
|
|
83276
83476
|
"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}
|
|
83277
83477
|
` : "")
|
|
83278
83478
|
)
|
|
@@ -83281,7 +83481,7 @@ async function orderFood(items, opts) {
|
|
|
83281
83481
|
return;
|
|
83282
83482
|
}
|
|
83283
83483
|
process.stderr.write(
|
|
83284
|
-
|
|
83484
|
+
import_picocolors34.default.dim(
|
|
83285
83485
|
`Still being attempted. Check with: agentgates eat status ${orderId}` + (approvalUrl ? ` \u2014 or pay yourself: ${approvalUrl}` : "") + "\n"
|
|
83286
83486
|
)
|
|
83287
83487
|
);
|
|
@@ -83307,7 +83507,7 @@ var POLL_BUDGET_MS = 1e5;
|
|
|
83307
83507
|
var POLL_INTERVAL_MS2 = 3500;
|
|
83308
83508
|
async function pollOrderVerdict(orderId, resolved, jsonMode9) {
|
|
83309
83509
|
if (!jsonMode9) {
|
|
83310
|
-
process.stderr.write(
|
|
83510
|
+
process.stderr.write(import_picocolors34.default.dim("Your saved card is paying this \u2014 watching for the result\u2026\n"));
|
|
83311
83511
|
}
|
|
83312
83512
|
const deadline = Date.now() + POLL_BUDGET_MS;
|
|
83313
83513
|
let last = {
|
|
@@ -83377,17 +83577,17 @@ async function statusFood(orderId, opts) {
|
|
|
83377
83577
|
}
|
|
83378
83578
|
|
|
83379
83579
|
// src/commands/bounties.ts
|
|
83380
|
-
var
|
|
83580
|
+
var import_picocolors35 = __toESM(require_picocolors(), 1);
|
|
83381
83581
|
init_constants();
|
|
83382
83582
|
async function withProfile(opts, path12, init2) {
|
|
83383
83583
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
83384
83584
|
const resolved = await resolveProfile(requested);
|
|
83385
83585
|
if (!resolved) {
|
|
83386
|
-
process.stderr.write(
|
|
83586
|
+
process.stderr.write(import_picocolors35.default.red("Not logged in. Run agentgates login first.\n"));
|
|
83387
83587
|
process.exit(2);
|
|
83388
83588
|
}
|
|
83389
83589
|
if (resolved.autoSelected) {
|
|
83390
|
-
process.stderr.write(
|
|
83590
|
+
process.stderr.write(import_picocolors35.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
83391
83591
|
`));
|
|
83392
83592
|
}
|
|
83393
83593
|
const { profile, name: profileName } = resolved;
|
|
@@ -83396,7 +83596,7 @@ async function withProfile(opts, path12, init2) {
|
|
|
83396
83596
|
profile,
|
|
83397
83597
|
profileName,
|
|
83398
83598
|
jsonMode: jsonMode9,
|
|
83399
|
-
ttyHeader:
|
|
83599
|
+
ttyHeader: import_picocolors35.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
83400
83600
|
fn: (bearer, origin) => apiFetch(path12, init2 ? { bearer, origin, method: init2.method, body: init2.body } : { bearer, origin })
|
|
83401
83601
|
});
|
|
83402
83602
|
if (outcome.kind === "auth_failed") {
|
|
@@ -83404,14 +83604,14 @@ async function withProfile(opts, path12, init2) {
|
|
|
83404
83604
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
83405
83605
|
process.exit(1);
|
|
83406
83606
|
}
|
|
83407
|
-
process.stderr.write(
|
|
83607
|
+
process.stderr.write(import_picocolors35.default.red(`\u2715 ${outcome.reason}.
|
|
83408
83608
|
`));
|
|
83409
83609
|
process.exit(1);
|
|
83410
83610
|
}
|
|
83411
83611
|
if (outcome.kind === "error") {
|
|
83412
83612
|
const err = outcome.error;
|
|
83413
83613
|
if (err instanceof ApiError) {
|
|
83414
|
-
process.stderr.write(
|
|
83614
|
+
process.stderr.write(import_picocolors35.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
83415
83615
|
`));
|
|
83416
83616
|
process.exit(1);
|
|
83417
83617
|
}
|
|
@@ -83425,12 +83625,12 @@ function handleBlocked(res, jsonMode9) {
|
|
|
83425
83625
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
83426
83626
|
process.exit(1);
|
|
83427
83627
|
}
|
|
83428
|
-
process.stderr.write(
|
|
83628
|
+
process.stderr.write(import_picocolors35.default.yellow(`
|
|
83429
83629
|
${res.reason ?? "Blocked."}
|
|
83430
83630
|
`));
|
|
83431
83631
|
if (res.upgrade_url) {
|
|
83432
83632
|
process.stderr.write(`
|
|
83433
|
-
${
|
|
83633
|
+
${import_picocolors35.default.bold(res.upgrade_url)}
|
|
83434
83634
|
|
|
83435
83635
|
`);
|
|
83436
83636
|
}
|
|
@@ -83473,14 +83673,14 @@ function printTable(rows) {
|
|
|
83473
83673
|
const cLeft = w("left", 4);
|
|
83474
83674
|
const cSubs = w("subs", 4);
|
|
83475
83675
|
process.stdout.write(
|
|
83476
|
-
|
|
83676
|
+
import_picocolors35.default.dim(
|
|
83477
83677
|
"Amount".padStart(cAmount) + " " + "Title".padEnd(cTitle) + " " + "Chain".padEnd(cChain) + " " + "Evidence".padEnd(cEv) + " " + "Left".padStart(cLeft) + " " + "Subs".padStart(cSubs) + " ID"
|
|
83478
83678
|
) + "\n"
|
|
83479
83679
|
);
|
|
83480
83680
|
for (const c of cells) {
|
|
83481
|
-
const title = c.live ?
|
|
83681
|
+
const title = c.live ? import_picocolors35.default.green(c.title.padEnd(cTitle)) : c.title.padEnd(cTitle);
|
|
83482
83682
|
process.stdout.write(
|
|
83483
|
-
|
|
83683
|
+
import_picocolors35.default.bold(c.amount.padStart(cAmount)) + " " + title + " " + c.chain.padEnd(cChain) + " " + c.ev.padEnd(cEv) + " " + c.left.padStart(cLeft) + " " + c.subs.padStart(cSubs) + " " + import_picocolors35.default.dim(c.id) + "\n"
|
|
83484
83684
|
);
|
|
83485
83685
|
}
|
|
83486
83686
|
}
|
|
@@ -83492,11 +83692,11 @@ async function listBounties(opts) {
|
|
|
83492
83692
|
const min = opts.min !== void 0 ? Number(opts.min) : void 0;
|
|
83493
83693
|
const max = opts.max !== void 0 ? Number(opts.max) : void 0;
|
|
83494
83694
|
if (min !== void 0 && !Number.isFinite(min)) {
|
|
83495
|
-
process.stderr.write(
|
|
83695
|
+
process.stderr.write(import_picocolors35.default.red("\u2715 --min must be a number.\n"));
|
|
83496
83696
|
process.exit(2);
|
|
83497
83697
|
}
|
|
83498
83698
|
if (max !== void 0 && !Number.isFinite(max)) {
|
|
83499
|
-
process.stderr.write(
|
|
83699
|
+
process.stderr.write(import_picocolors35.default.red("\u2715 --max must be a number.\n"));
|
|
83500
83700
|
process.exit(2);
|
|
83501
83701
|
}
|
|
83502
83702
|
rows = rows.filter((r) => {
|
|
@@ -83521,7 +83721,7 @@ async function listBounties(opts) {
|
|
|
83521
83721
|
});
|
|
83522
83722
|
const limit = opts.limit !== void 0 ? Number(opts.limit) : 20;
|
|
83523
83723
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
83524
|
-
process.stderr.write(
|
|
83724
|
+
process.stderr.write(import_picocolors35.default.red("\u2715 --limit must be a positive number.\n"));
|
|
83525
83725
|
process.exit(2);
|
|
83526
83726
|
}
|
|
83527
83727
|
const shown2 = rows.slice(0, limit);
|
|
@@ -83530,13 +83730,13 @@ async function listBounties(opts) {
|
|
|
83530
83730
|
return;
|
|
83531
83731
|
}
|
|
83532
83732
|
if (shown2.length === 0) {
|
|
83533
|
-
process.stdout.write(
|
|
83733
|
+
process.stdout.write(import_picocolors35.default.dim("No active bounties match.\n"));
|
|
83534
83734
|
return;
|
|
83535
83735
|
}
|
|
83536
83736
|
printTable(shown2);
|
|
83537
83737
|
const clipped = rows.length - shown2.length;
|
|
83538
83738
|
process.stdout.write(
|
|
83539
|
-
"\n" +
|
|
83739
|
+
"\n" + import_picocolors35.default.dim(
|
|
83540
83740
|
`${shown2.length} of ${rows.length} matching${clipped > 0 ? ` (${clipped} more \u2014 raise --limit)` : ""}. agentgates show <id> for detail.
|
|
83541
83741
|
`
|
|
83542
83742
|
)
|
|
@@ -83547,7 +83747,7 @@ async function showBounty(id2, opts) {
|
|
|
83547
83747
|
const jsonMode9 = opts.json === true;
|
|
83548
83748
|
const clean3 = id2.trim().replace(/^.*\/bounty\//, "").replace(/[?#].*$/, "").trim();
|
|
83549
83749
|
if (!clean3) {
|
|
83550
|
-
process.stderr.write(
|
|
83750
|
+
process.stderr.write(import_picocolors35.default.red("\u2715 Give a bounty id, or a agentgates.ai/bounty/<id> link.\n"));
|
|
83551
83751
|
process.exit(2);
|
|
83552
83752
|
}
|
|
83553
83753
|
const res = await withProfile(opts, `/api/bounties/${encodeURIComponent(clean3)}`);
|
|
@@ -83558,26 +83758,26 @@ async function showBounty(id2, opts) {
|
|
|
83558
83758
|
}
|
|
83559
83759
|
const b2 = res.bounty;
|
|
83560
83760
|
if (!b2) {
|
|
83561
|
-
process.stdout.write(
|
|
83761
|
+
process.stdout.write(import_picocolors35.default.dim("Not found.\n"));
|
|
83562
83762
|
return;
|
|
83563
83763
|
}
|
|
83564
|
-
process.stdout.write("\n" +
|
|
83764
|
+
process.stdout.write("\n" + import_picocolors35.default.bold(b2.title) + "\n\n");
|
|
83565
83765
|
process.stdout.write(b2.description + "\n\n");
|
|
83566
83766
|
process.stdout.write(
|
|
83567
|
-
|
|
83767
|
+
import_picocolors35.default.bold(fmtAmount(b2.amount)) + import_picocolors35.default.dim(" USDC") + import_picocolors35.default.dim(` \xB7 ${chainOf2(b2)} \xB7 ${b2.status.toLowerCase()}`) + (b2.liveNow ? import_picocolors35.default.green(" \xB7 LIVE now") : "") + "\n"
|
|
83568
83768
|
);
|
|
83569
83769
|
if (b2.claimsAllowed && b2.claimsAllowed > 1) {
|
|
83570
83770
|
const left = Math.max(0, b2.claimsAllowed - (b2.claimsPaid ?? 0));
|
|
83571
83771
|
process.stdout.write(
|
|
83572
|
-
|
|
83772
|
+
import_picocolors35.default.dim(
|
|
83573
83773
|
`${left} of ${b2.claimsAllowed} claims left` + (b2.perClaimAmount != null ? `, ${fmtAmount(b2.perClaimAmount)} each` : "")
|
|
83574
83774
|
) + "\n"
|
|
83575
83775
|
);
|
|
83576
83776
|
}
|
|
83577
|
-
if (b2.evidenceType) process.stdout.write(
|
|
83578
|
-
if (b2.expiresAt) process.stdout.write(
|
|
83777
|
+
if (b2.evidenceType) process.stdout.write(import_picocolors35.default.dim(`Evidence required: ${b2.evidenceType}`) + "\n");
|
|
83778
|
+
if (b2.expiresAt) process.stdout.write(import_picocolors35.default.dim(`Expires in ${fmtExpiry(b2.expiresAt)}`) + "\n");
|
|
83579
83779
|
if (b2.geoLabel && b2.geoScope !== "global") {
|
|
83580
|
-
process.stdout.write(
|
|
83780
|
+
process.stdout.write(import_picocolors35.default.dim(`Creator says: ${b2.geoLabel}`) + "\n");
|
|
83581
83781
|
}
|
|
83582
83782
|
if (res.url) process.stdout.write("\n" + res.url + "\n");
|
|
83583
83783
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -83595,7 +83795,7 @@ async function myBounties(opts) {
|
|
|
83595
83795
|
}
|
|
83596
83796
|
if (rows.length === 0) {
|
|
83597
83797
|
process.stdout.write(
|
|
83598
|
-
|
|
83798
|
+
import_picocolors35.default.dim(
|
|
83599
83799
|
status4 ? `No bounties of yours are ${status4}.
|
|
83600
83800
|
` : "You have not created any bounties yet. `agentgates draft` starts one.\n"
|
|
83601
83801
|
)
|
|
@@ -83605,7 +83805,7 @@ async function myBounties(opts) {
|
|
|
83605
83805
|
printTable(rows);
|
|
83606
83806
|
const subs = res.submissions ?? [];
|
|
83607
83807
|
if (subs.length > 0) {
|
|
83608
|
-
process.stdout.write("\n" +
|
|
83808
|
+
process.stdout.write("\n" + import_picocolors35.default.dim(`Plus ${subs.length} submission(s) on other people's bounties.
|
|
83609
83809
|
`));
|
|
83610
83810
|
}
|
|
83611
83811
|
process.stdout.write(AI_DIRECTIVE + "\n");
|
|
@@ -83624,19 +83824,19 @@ async function bountyFeed(opts) {
|
|
|
83624
83824
|
}
|
|
83625
83825
|
const subs = res.submissions ?? [];
|
|
83626
83826
|
if (subs.length === 0) {
|
|
83627
|
-
process.stdout.write(
|
|
83827
|
+
process.stdout.write(import_picocolors35.default.dim("Nothing in the feed for that filter.\n"));
|
|
83628
83828
|
return;
|
|
83629
83829
|
}
|
|
83630
83830
|
process.stdout.write(
|
|
83631
|
-
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ?
|
|
83831
|
+
`${subs.length} submission(s) shown of ${res.total ?? subs.length} total.` + (res.hasMore ? import_picocolors35.default.dim(" More available.") : "") + "\n"
|
|
83632
83832
|
);
|
|
83633
|
-
process.stdout.write(
|
|
83833
|
+
process.stdout.write(import_picocolors35.default.dim("Use --json for the full rows.\n"));
|
|
83634
83834
|
}
|
|
83635
83835
|
async function draftBounty(opts) {
|
|
83636
83836
|
const jsonMode9 = opts.json === true;
|
|
83637
83837
|
const amountNum = Number(opts.amount);
|
|
83638
83838
|
if (!Number.isFinite(amountNum) || amountNum <= 0) {
|
|
83639
|
-
process.stderr.write(
|
|
83839
|
+
process.stderr.write(import_picocolors35.default.red("\u2715 --amount must be a positive number of USDC.\n"));
|
|
83640
83840
|
process.exit(2);
|
|
83641
83841
|
}
|
|
83642
83842
|
const res = await withProfile(opts, "/api/bounties", {
|
|
@@ -83654,20 +83854,20 @@ async function draftBounty(opts) {
|
|
|
83654
83854
|
process.stdout.write(JSON.stringify(res, null, 2) + "\n");
|
|
83655
83855
|
return;
|
|
83656
83856
|
}
|
|
83657
|
-
process.stdout.write("\n" +
|
|
83857
|
+
process.stdout.write("\n" + import_picocolors35.default.green("\u2713") + ` Drafted "${opts.title}" for $${opts.amount} USDC.
|
|
83658
83858
|
|
|
83659
83859
|
`);
|
|
83660
|
-
process.stdout.write(
|
|
83860
|
+
process.stdout.write(import_picocolors35.default.dim("It is a draft. Nobody can see or claim it until you fund the escrow.\n"));
|
|
83661
83861
|
if (res.fund_url) {
|
|
83662
|
-
process.stdout.write("\nFund it here:\n" +
|
|
83663
|
-
process.stdout.write(
|
|
83862
|
+
process.stdout.write("\nFund it here:\n" + import_picocolors35.default.bold(res.fund_url) + "\n\n");
|
|
83863
|
+
process.stdout.write(import_picocolors35.default.dim("Funding happens in your browser with your own wallet.\n"));
|
|
83664
83864
|
}
|
|
83665
83865
|
}
|
|
83666
83866
|
|
|
83667
83867
|
// src/commands/bounty-money.ts
|
|
83668
|
-
var
|
|
83868
|
+
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
83669
83869
|
function failArg6(message) {
|
|
83670
|
-
process.stderr.write(
|
|
83870
|
+
process.stderr.write(import_picocolors36.default.red(`${message}
|
|
83671
83871
|
`));
|
|
83672
83872
|
process.exit(2);
|
|
83673
83873
|
}
|
|
@@ -83679,12 +83879,12 @@ async function loadProfileOrExit(requested, jsonMode9) {
|
|
|
83679
83879
|
JSON.stringify({ ok: false, status: "auth_failed", error: "Not logged in. Run agentgates login first." }) + "\n"
|
|
83680
83880
|
);
|
|
83681
83881
|
} else {
|
|
83682
|
-
process.stderr.write(
|
|
83882
|
+
process.stderr.write(import_picocolors36.default.red("Not logged in. Run agentgates login first.\n"));
|
|
83683
83883
|
}
|
|
83684
83884
|
process.exit(2);
|
|
83685
83885
|
}
|
|
83686
83886
|
if (resolved.autoSelected && !jsonMode9) {
|
|
83687
|
-
process.stderr.write(
|
|
83887
|
+
process.stderr.write(import_picocolors36.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
83688
83888
|
`));
|
|
83689
83889
|
}
|
|
83690
83890
|
return { profile: resolved.profile, profileName: resolved.name };
|
|
@@ -83707,6 +83907,7 @@ async function fundBounty(bountyId, opts) {
|
|
|
83707
83907
|
const { profile, profileName } = await loadProfileOrExit(opts.profile ?? DEFAULT_PROFILE, jsonMode9);
|
|
83708
83908
|
const maxUsd = resolveMaxUsd(opts, profile, "agentgates fund");
|
|
83709
83909
|
return runIntentFlow({
|
|
83910
|
+
wallet: opts.wallet,
|
|
83710
83911
|
endpoint: "/api/intents/propose-fund-bounty",
|
|
83711
83912
|
body: {
|
|
83712
83913
|
bounty_id: bountyId,
|
|
@@ -83736,6 +83937,7 @@ async function tipBounty(bountyId, amount, opts) {
|
|
|
83736
83937
|
const { profile, profileName } = await loadProfileOrExit(opts.profile ?? DEFAULT_PROFILE, jsonMode9);
|
|
83737
83938
|
const maxUsd = opts.maxUsd !== void 0 ? resolveMaxUsd(opts, profile, "agentgates tip") : Math.ceil(amt * 1.01 * 100) / 100;
|
|
83738
83939
|
return runIntentFlow({
|
|
83940
|
+
wallet: opts.wallet,
|
|
83739
83941
|
endpoint: "/api/intents/propose-tip",
|
|
83740
83942
|
body: {
|
|
83741
83943
|
bounty_id: bountyId,
|
|
@@ -83766,6 +83968,7 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
83766
83968
|
const { profile, profileName } = await loadProfileOrExit(opts.profile ?? DEFAULT_PROFILE, jsonMode9);
|
|
83767
83969
|
const maxUsd = resolveMaxUsd(opts, profile, "agentgates subscribe");
|
|
83768
83970
|
return runIntentFlow({
|
|
83971
|
+
wallet: opts.wallet,
|
|
83769
83972
|
endpoint: "/api/intents/propose-subscribe",
|
|
83770
83973
|
body: {
|
|
83771
83974
|
creator_user_id: creatorUserId,
|
|
@@ -83789,17 +83992,17 @@ async function subscribeCreator(creatorUserId, opts) {
|
|
|
83789
83992
|
}
|
|
83790
83993
|
|
|
83791
83994
|
// src/commands/bounty-work.ts
|
|
83792
|
-
var
|
|
83995
|
+
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
83793
83996
|
init_constants();
|
|
83794
83997
|
async function runWork(path12, body, opts) {
|
|
83795
83998
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
83796
83999
|
const resolved = await resolveProfile(requested);
|
|
83797
84000
|
if (!resolved) {
|
|
83798
|
-
process.stderr.write(
|
|
84001
|
+
process.stderr.write(import_picocolors37.default.red("Not logged in. Run agentgates login first.\n"));
|
|
83799
84002
|
process.exit(2);
|
|
83800
84003
|
}
|
|
83801
84004
|
if (resolved.autoSelected) {
|
|
83802
|
-
process.stderr.write(
|
|
84005
|
+
process.stderr.write(import_picocolors37.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
83803
84006
|
`));
|
|
83804
84007
|
}
|
|
83805
84008
|
const jsonMode9 = opts.json === true;
|
|
@@ -83807,7 +84010,7 @@ async function runWork(path12, body, opts) {
|
|
|
83807
84010
|
profile: resolved.profile,
|
|
83808
84011
|
profileName: resolved.name,
|
|
83809
84012
|
jsonMode: jsonMode9,
|
|
83810
|
-
ttyHeader:
|
|
84013
|
+
ttyHeader: import_picocolors37.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
83811
84014
|
fn: (bearer, origin) => apiFetch(path12, { bearer, origin, method: "POST", body })
|
|
83812
84015
|
});
|
|
83813
84016
|
if (outcome.kind === "auth_failed") {
|
|
@@ -83815,7 +84018,7 @@ async function runWork(path12, body, opts) {
|
|
|
83815
84018
|
process.stdout.write(JSON.stringify({ ok: false, status: "auth_failed", error: outcome.reason }) + "\n");
|
|
83816
84019
|
process.exit(1);
|
|
83817
84020
|
}
|
|
83818
|
-
process.stderr.write(
|
|
84021
|
+
process.stderr.write(import_picocolors37.default.red(`\u2715 ${outcome.reason}.
|
|
83819
84022
|
`));
|
|
83820
84023
|
process.exit(1);
|
|
83821
84024
|
}
|
|
@@ -83825,7 +84028,7 @@ async function runWork(path12, body, opts) {
|
|
|
83825
84028
|
if (jsonMode9) {
|
|
83826
84029
|
process.stdout.write(JSON.stringify({ ok: false, error: err.message, http_status: err.status }) + "\n");
|
|
83827
84030
|
} else {
|
|
83828
|
-
process.stderr.write(
|
|
84031
|
+
process.stderr.write(import_picocolors37.default.red(`\u2715 ${err.message} (HTTP ${err.status})
|
|
83829
84032
|
`));
|
|
83830
84033
|
}
|
|
83831
84034
|
process.exit(1);
|
|
@@ -83838,11 +84041,11 @@ async function runWork(path12, body, opts) {
|
|
|
83838
84041
|
process.stdout.write(JSON.stringify({ ok: false, ...data4 }) + "\n");
|
|
83839
84042
|
process.exit(1);
|
|
83840
84043
|
}
|
|
83841
|
-
process.stderr.write(
|
|
84044
|
+
process.stderr.write(import_picocolors37.default.yellow(`
|
|
83842
84045
|
${data4.reason ?? "Blocked."}
|
|
83843
84046
|
`));
|
|
83844
84047
|
if (data4.upgrade_url) process.stderr.write(`
|
|
83845
|
-
${
|
|
84048
|
+
${import_picocolors37.default.bold(data4.upgrade_url)}
|
|
83846
84049
|
|
|
83847
84050
|
`);
|
|
83848
84051
|
process.exit(1);
|
|
@@ -83851,7 +84054,7 @@ ${import_picocolors36.default.bold(data4.upgrade_url)}
|
|
|
83851
84054
|
if (jsonMode9) {
|
|
83852
84055
|
process.stdout.write(JSON.stringify({ ok: false, error: data4.error }) + "\n");
|
|
83853
84056
|
} else {
|
|
83854
|
-
process.stderr.write(
|
|
84057
|
+
process.stderr.write(import_picocolors37.default.red(`\u2715 ${data4.error}
|
|
83855
84058
|
`));
|
|
83856
84059
|
}
|
|
83857
84060
|
process.exit(1);
|
|
@@ -83894,7 +84097,7 @@ async function bountyRetention(bountyId, opts) {
|
|
|
83894
84097
|
}
|
|
83895
84098
|
|
|
83896
84099
|
// src/commands/bounty-deliver.ts
|
|
83897
|
-
var
|
|
84100
|
+
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
83898
84101
|
import { spawn as spawn2 } from "node:child_process";
|
|
83899
84102
|
init_constants();
|
|
83900
84103
|
var FLUSH_MS = 400;
|
|
@@ -83904,11 +84107,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
83904
84107
|
const requested = opts.profile ?? DEFAULT_PROFILE;
|
|
83905
84108
|
const resolved = await resolveProfile(requested);
|
|
83906
84109
|
if (!resolved) {
|
|
83907
|
-
process.stderr.write(
|
|
84110
|
+
process.stderr.write(import_picocolors38.default.red("Not logged in. Run agentgates login first.\n"));
|
|
83908
84111
|
process.exit(2);
|
|
83909
84112
|
}
|
|
83910
84113
|
if (resolved.autoSelected && !jsonMode9) {
|
|
83911
|
-
process.stderr.write(
|
|
84114
|
+
process.stderr.write(import_picocolors38.default.dim(`Using profile "${resolved.name}" (pass --profile to choose)
|
|
83912
84115
|
`));
|
|
83913
84116
|
}
|
|
83914
84117
|
const post3 = async (path12, body) => {
|
|
@@ -83916,7 +84119,7 @@ async function deliver(bountyId, command, opts) {
|
|
|
83916
84119
|
profile: resolved.profile,
|
|
83917
84120
|
profileName: resolved.name,
|
|
83918
84121
|
jsonMode: jsonMode9,
|
|
83919
|
-
ttyHeader:
|
|
84122
|
+
ttyHeader: import_picocolors38.default.dim("Bearer expired \u2014 re-pairing this terminal\u2026"),
|
|
83920
84123
|
fn: (bearer, origin) => apiFetch(path12, { bearer, origin, method: "POST", body })
|
|
83921
84124
|
});
|
|
83922
84125
|
if (outcome.kind === "auth_failed") throw new Error(outcome.reason);
|
|
@@ -83927,11 +84130,11 @@ async function deliver(bountyId, command, opts) {
|
|
|
83927
84130
|
if (jsonMode9) {
|
|
83928
84131
|
process.stdout.write(JSON.stringify({ ok: false, error: msg, ...data4 ?? {} }) + "\n");
|
|
83929
84132
|
} else {
|
|
83930
|
-
process.stderr.write(
|
|
84133
|
+
process.stderr.write(import_picocolors38.default.red(`
|
|
83931
84134
|
\u2715 ${msg}
|
|
83932
84135
|
`));
|
|
83933
84136
|
if (data4?.upgrade_url) process.stderr.write(`
|
|
83934
|
-
${
|
|
84137
|
+
${import_picocolors38.default.bold(data4.upgrade_url)}
|
|
83935
84138
|
|
|
83936
84139
|
`);
|
|
83937
84140
|
}
|
|
@@ -83956,7 +84159,7 @@ ${import_picocolors37.default.bold(data4.upgrade_url)}
|
|
|
83956
84159
|
if (!runId) return void die("The service opened a run but did not name it.");
|
|
83957
84160
|
if (!jsonMode9) {
|
|
83958
84161
|
process.stderr.write(
|
|
83959
|
-
|
|
84162
|
+
import_picocolors38.default.bold("\n\u25CF LIVE ") + import_picocolors38.default.dim("everything below is going onto the bounty page as it happens\n") + import_picocolors38.default.dim(` ${started.url ?? ""}
|
|
83960
84163
|
|
|
83961
84164
|
`)
|
|
83962
84165
|
);
|
|
@@ -84008,10 +84211,10 @@ ${import_picocolors37.default.bold(data4.upgrade_url)}
|
|
|
84008
84211
|
child.stdout.on("data", (d) => consume(d));
|
|
84009
84212
|
child.stderr.setEncoding("utf8");
|
|
84010
84213
|
child.stderr.on("data", (d) => {
|
|
84011
|
-
if (!jsonMode9) process.stderr.write(
|
|
84214
|
+
if (!jsonMode9) process.stderr.write(import_picocolors38.default.dim(d));
|
|
84012
84215
|
});
|
|
84013
84216
|
child.on("error", (err) => {
|
|
84014
|
-
process.stderr.write(
|
|
84217
|
+
process.stderr.write(import_picocolors38.default.red(`
|
|
84015
84218
|
\u2715 Could not run ${command[0]}: ${err.message}
|
|
84016
84219
|
`));
|
|
84017
84220
|
resolve5(127);
|
|
@@ -84048,14 +84251,14 @@ ${import_picocolors37.default.bold(data4.upgrade_url)}
|
|
|
84048
84251
|
}
|
|
84049
84252
|
if (appendFailure) {
|
|
84050
84253
|
process.stderr.write(
|
|
84051
|
-
|
|
84254
|
+
import_picocolors38.default.yellow(`
|
|
84052
84255
|
! Some output did not reach the page: ${appendFailure}
|
|
84053
|
-
`) +
|
|
84256
|
+
`) + import_picocolors38.default.yellow(" What did arrive is sealed below. Check it before you submit.\n")
|
|
84054
84257
|
);
|
|
84055
84258
|
}
|
|
84056
84259
|
if (exitCode) {
|
|
84057
84260
|
process.stderr.write(
|
|
84058
|
-
|
|
84261
|
+
import_picocolors38.default.yellow(`
|
|
84059
84262
|
! ${command[0]} exited ${exitCode}. The run was sealed with what it produced.
|
|
84060
84263
|
`)
|
|
84061
84264
|
);
|
|
@@ -84065,7 +84268,7 @@ ${import_picocolors37.default.bold(data4.upgrade_url)}
|
|
|
84065
84268
|
}
|
|
84066
84269
|
|
|
84067
84270
|
// src/commands/trade.ts
|
|
84068
|
-
var
|
|
84271
|
+
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
84069
84272
|
init_constants();
|
|
84070
84273
|
|
|
84071
84274
|
// src/lib/trade-sol.ts
|
|
@@ -84434,7 +84637,7 @@ function fail10(message, json2) {
|
|
|
84434
84637
|
if (json2) {
|
|
84435
84638
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
84436
84639
|
} else {
|
|
84437
|
-
process.stderr.write(
|
|
84640
|
+
process.stderr.write(import_picocolors39.default.red(`\u2715 ${message}
|
|
84438
84641
|
`));
|
|
84439
84642
|
}
|
|
84440
84643
|
process.exit(1);
|
|
@@ -84625,7 +84828,7 @@ async function tradeBuy(coinArg, amount, opts) {
|
|
|
84625
84828
|
}
|
|
84626
84829
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
84627
84830
|
if (created && !opts.json) {
|
|
84628
|
-
process.stderr.write(
|
|
84831
|
+
process.stderr.write(import_picocolors39.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
84629
84832
|
`));
|
|
84630
84833
|
}
|
|
84631
84834
|
const result = await runTrade({ ctx: ctx2, keypair, token: coin.mint, side: "buy", amount, minOut: opts.minOut });
|
|
@@ -84679,7 +84882,7 @@ async function tradeOrderPlace(coinArg, opts) {
|
|
|
84679
84882
|
if (opts.mcap && !opts.at) fail10("--mcap qualifies --at.", opts.json);
|
|
84680
84883
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
84681
84884
|
if (created && !opts.json) {
|
|
84682
|
-
process.stderr.write(
|
|
84885
|
+
process.stderr.write(import_picocolors39.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
84683
84886
|
`));
|
|
84684
84887
|
}
|
|
84685
84888
|
let amount;
|
|
@@ -84844,7 +85047,7 @@ async function tradePositions(opts) {
|
|
|
84844
85047
|
}
|
|
84845
85048
|
|
|
84846
85049
|
// src/commands/desk.ts
|
|
84847
|
-
var
|
|
85050
|
+
var import_picocolors40 = __toESM(require_picocolors(), 1);
|
|
84848
85051
|
init_constants();
|
|
84849
85052
|
|
|
84850
85053
|
// src/lib/desk-sol.ts
|
|
@@ -85019,7 +85222,7 @@ function fail11(message, json2) {
|
|
|
85019
85222
|
if (json2) {
|
|
85020
85223
|
process.stdout.write(JSON.stringify({ ok: false, error: message }) + "\n");
|
|
85021
85224
|
} else {
|
|
85022
|
-
process.stderr.write(
|
|
85225
|
+
process.stderr.write(import_picocolors40.default.red(`\u2715 ${message}
|
|
85023
85226
|
`));
|
|
85024
85227
|
}
|
|
85025
85228
|
process.exit(1);
|
|
@@ -85162,7 +85365,7 @@ async function deskDeposit(amount, opts) {
|
|
|
85162
85365
|
if (units <= 0n) fail11("Deposit amount must be above zero.", opts.json);
|
|
85163
85366
|
const { keypair, state, created } = await loadOrCreateTradeKey();
|
|
85164
85367
|
if (created && !opts.json) {
|
|
85165
|
-
process.stderr.write(
|
|
85368
|
+
process.stderr.write(import_picocolors40.default.dim(`Generated the agent trading key ${state.address} (${tradeKeyPath()}).
|
|
85166
85369
|
`));
|
|
85167
85370
|
}
|
|
85168
85371
|
const result = await runDeskCeremony({
|
|
@@ -85257,13 +85460,13 @@ async function deskSessionRegister(opts) {
|
|
|
85257
85460
|
}
|
|
85258
85461
|
const owner = await loadOrCreateTradeKey();
|
|
85259
85462
|
if (owner.created && !opts.json) {
|
|
85260
|
-
process.stderr.write(
|
|
85463
|
+
process.stderr.write(import_picocolors40.default.dim(`Generated the agent trading key ${owner.state.address} (${tradeKeyPath()}).
|
|
85261
85464
|
`));
|
|
85262
85465
|
}
|
|
85263
85466
|
const session = await loadOrCreateDeskSessionKey();
|
|
85264
85467
|
if (session.created && !opts.json) {
|
|
85265
85468
|
process.stderr.write(
|
|
85266
|
-
|
|
85469
|
+
import_picocolors40.default.dim(`Generated the desk session key ${session.state.address} (${deskSessionKeyPath()}).
|
|
85267
85470
|
`)
|
|
85268
85471
|
);
|
|
85269
85472
|
}
|
|
@@ -85455,6 +85658,9 @@ program2.command("logout").description("Revoke the current pairing and wipe the
|
|
|
85455
85658
|
program2.command("whoami").description("Print the paired wallet, its scopes and caps for the active pairing").option("--profile <name>", "named profile (default: 'default')").option("--json", "machine-readable output").action(async (opts) => {
|
|
85456
85659
|
await whoami({ profile: opts.profile, json: opts.json });
|
|
85457
85660
|
});
|
|
85661
|
+
program2.command("wallets").description("List the wallets this terminal may propose from (your main wallet, and the treasuries ticked when you paired it). Pass a name to --wallet on send, swap, batch, fund, earn, tip, subscribe, balance or history").option("--profile <name>", "named profile (default: 'default')").option("--json", "machine-readable output").action(async (opts) => {
|
|
85662
|
+
await wallets({ profile: opts.profile, json: opts.json });
|
|
85663
|
+
});
|
|
85458
85664
|
program2.command("send").description(
|
|
85459
85665
|
"Propose a fund-moving send. Opens your browser for biometric approval (default; --no-browser or CI=1 to skip), then polls until mined."
|
|
85460
85666
|
).argument("<amount>", 'amount in display units (e.g. "5" for 5 USDC)').argument("<asset>", "native | usdc").requiredOption(
|
|
@@ -85466,7 +85672,7 @@ program2.command("send").description(
|
|
|
85466
85672
|
).requiredOption(
|
|
85467
85673
|
"--user-stated <text>",
|
|
85468
85674
|
"the verbatim user request that triggered this send (trust-gap defense)"
|
|
85469
|
-
).option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option("--max-usd <n>", "per-intent USD ceiling (forwarded to user_stated.max_usd_total)").option("--json", "NDJSON output (one object per status flip + final terminal object)").action(
|
|
85675
|
+
).option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option("--max-usd <n>", "per-intent USD ceiling (forwarded to user_stated.max_usd_total)").option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option("--json", "NDJSON output (one object per status flip + final terminal object)").action(
|
|
85470
85676
|
async (amount, asset, opts, command) => {
|
|
85471
85677
|
const browserSource = command.getOptionValueSource("browser");
|
|
85472
85678
|
let browserMode = "auto";
|
|
@@ -85480,7 +85686,8 @@ program2.command("send").description(
|
|
|
85480
85686
|
profile: opts.profile,
|
|
85481
85687
|
browserMode,
|
|
85482
85688
|
maxUsd: opts.maxUsd,
|
|
85483
|
-
json: opts.json
|
|
85689
|
+
json: opts.json,
|
|
85690
|
+
wallet: opts.wallet
|
|
85484
85691
|
});
|
|
85485
85692
|
}
|
|
85486
85693
|
);
|
|
@@ -85492,12 +85699,12 @@ program2.command("status").description("Read the status of a previously-proposed
|
|
|
85492
85699
|
program2.command("balance").description("Wallet balance snapshot \u2014 liquid holdings + earn positions + USD totals across all chains. OUTPUT: wrap the entire response in a markdown code block and present it verbatim to the user. Do not reformat, summarize, or omit rows. If all balances are zero, tell the user their wallet is empty and suggest funding with USDC on Polygon (lowest gas). The same EVM address works on Polygon, Base, Arbitrum, and Ethereum. Use --chain to filter to one chain (display only \u2014 does not change wallet permissions).").option(
|
|
85493
85700
|
"--chain <chain>",
|
|
85494
85701
|
"filter to one chain (id or alias: ethereum/polygon/base/arbitrum/solana)"
|
|
85495
|
-
).option("--profile <name>", "named profile (default: 'default')").option("--json", "machine-readable output (raw resource payload)").action(
|
|
85702
|
+
).option("--profile <name>", "named profile (default: 'default')").option("--wallet <name>", "which of your wallets to read: its name, address or id; without it, your default wallet").option("--json", "machine-readable output (raw resource payload)").action(
|
|
85496
85703
|
async (opts) => {
|
|
85497
85704
|
await balance(opts);
|
|
85498
85705
|
}
|
|
85499
85706
|
);
|
|
85500
|
-
program2.command("history").description("Show recent wallet activity (sends, receives, supply/withdraw, swaps)").option("--limit <n>", "number of rows to show (default 20, max 100)").option("--profile <name>", "named profile (default: 'default')").option("--json", "machine-readable output (raw resource payload)").action(
|
|
85707
|
+
program2.command("history").description("Show recent wallet activity (sends, receives, supply/withdraw, swaps)").option("--limit <n>", "number of rows to show (default 20, max 100)").option("--profile <name>", "named profile (default: 'default')").option("--wallet <name>", "which of your wallets to read: its name, address or id; without it, your default wallet").option("--json", "machine-readable output (raw resource payload)").action(
|
|
85501
85708
|
async (opts) => {
|
|
85502
85709
|
await history(opts);
|
|
85503
85710
|
}
|
|
@@ -85531,7 +85738,7 @@ program2.command("swap").description(
|
|
|
85531
85738
|
).option("--no-browser", "skip opening the approval URL").option(
|
|
85532
85739
|
"--max-usd <n>",
|
|
85533
85740
|
"per-intent USD ceiling (forwarded to user_stated.max_usd_total)"
|
|
85534
|
-
).option(
|
|
85741
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option(
|
|
85535
85742
|
"--json",
|
|
85536
85743
|
"NDJSON output (one object per status flip + final terminal object)"
|
|
85537
85744
|
).action(
|
|
@@ -85552,7 +85759,8 @@ program2.command("swap").description(
|
|
|
85552
85759
|
profile: opts.profile,
|
|
85553
85760
|
browserMode,
|
|
85554
85761
|
maxUsd: opts.maxUsd,
|
|
85555
|
-
json: opts.json
|
|
85762
|
+
json: opts.json,
|
|
85763
|
+
wallet: opts.wallet
|
|
85556
85764
|
});
|
|
85557
85765
|
}
|
|
85558
85766
|
);
|
|
@@ -85570,7 +85778,7 @@ program2.command("batch").description(
|
|
|
85570
85778
|
).option("--no-browser", "skip opening the approval URL").option(
|
|
85571
85779
|
"--max-usd <n>",
|
|
85572
85780
|
"USD ceiling for the WHOLE batch (forwarded to user_stated.max_usd_total)"
|
|
85573
|
-
).option(
|
|
85781
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option(
|
|
85574
85782
|
"--json",
|
|
85575
85783
|
"NDJSON output (one object per status flip + final terminal object with the per-leg journal)"
|
|
85576
85784
|
).action(
|
|
@@ -85587,7 +85795,8 @@ program2.command("batch").description(
|
|
|
85587
85795
|
profile: opts.profile,
|
|
85588
85796
|
browserMode,
|
|
85589
85797
|
maxUsd: opts.maxUsd,
|
|
85590
|
-
json: opts.json
|
|
85798
|
+
json: opts.json,
|
|
85799
|
+
wallet: opts.wallet
|
|
85591
85800
|
});
|
|
85592
85801
|
}
|
|
85593
85802
|
);
|
|
@@ -85609,7 +85818,7 @@ earn.command("supply").description(
|
|
|
85609
85818
|
).option("--no-browser", "skip opening the approval URL").option(
|
|
85610
85819
|
"--max-usd <n>",
|
|
85611
85820
|
"per-intent USD ceiling (forwarded to user_stated.max_usd_total)"
|
|
85612
|
-
).option(
|
|
85821
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option(
|
|
85613
85822
|
"--json",
|
|
85614
85823
|
"NDJSON output (one object per status flip + final terminal object)"
|
|
85615
85824
|
).action(
|
|
@@ -85626,7 +85835,8 @@ earn.command("supply").description(
|
|
|
85626
85835
|
profile: opts.profile,
|
|
85627
85836
|
browserMode,
|
|
85628
85837
|
maxUsd: opts.maxUsd,
|
|
85629
|
-
json: opts.json
|
|
85838
|
+
json: opts.json,
|
|
85839
|
+
wallet: opts.wallet
|
|
85630
85840
|
});
|
|
85631
85841
|
}
|
|
85632
85842
|
);
|
|
@@ -85647,7 +85857,7 @@ earn.command("withdraw").description(
|
|
|
85647
85857
|
).option("--no-browser", "skip opening the approval URL").option(
|
|
85648
85858
|
"--max-usd <n>",
|
|
85649
85859
|
"per-intent USD ceiling (forwarded to user_stated.max_usd_total)"
|
|
85650
|
-
).option(
|
|
85860
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option(
|
|
85651
85861
|
"--json",
|
|
85652
85862
|
"NDJSON output (one object per status flip + final terminal object)"
|
|
85653
85863
|
).action(
|
|
@@ -85664,7 +85874,8 @@ earn.command("withdraw").description(
|
|
|
85664
85874
|
profile: opts.profile,
|
|
85665
85875
|
browserMode,
|
|
85666
85876
|
maxUsd: opts.maxUsd,
|
|
85667
|
-
json: opts.json
|
|
85877
|
+
json: opts.json,
|
|
85878
|
+
wallet: opts.wallet
|
|
85668
85879
|
});
|
|
85669
85880
|
}
|
|
85670
85881
|
);
|
|
@@ -85789,7 +86000,7 @@ program2.command("fund").description(
|
|
|
85789
86000
|
).option("--usdc <n>", "address targets only: USDC the payer should receive, display units").option("--gas <n>", "address targets only: native gas the payer should receive, display units").option("--chain <chain>", "address targets only: chain id (1/137/8453/42161/900) or shortName").option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option(
|
|
85790
86001
|
"--max-usd <n>",
|
|
85791
86002
|
"your declared USD ceiling for this funding (default: the pairing per-tx cap)"
|
|
85792
|
-
).option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (target, opts, command) => {
|
|
86003
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (target, opts, command) => {
|
|
85793
86004
|
const browserSource = command.getOptionValueSource("browser");
|
|
85794
86005
|
let browserMode = "auto";
|
|
85795
86006
|
if (browserSource === "cli") {
|
|
@@ -85804,13 +86015,14 @@ program2.command("fund").description(
|
|
|
85804
86015
|
profile: opts.profile,
|
|
85805
86016
|
browserMode,
|
|
85806
86017
|
maxUsd: opts.maxUsd,
|
|
85807
|
-
json: opts.json
|
|
86018
|
+
json: opts.json,
|
|
86019
|
+
wallet: opts.wallet
|
|
85808
86020
|
});
|
|
85809
86021
|
return;
|
|
85810
86022
|
}
|
|
85811
86023
|
if (opts.usdc || opts.gas || opts.chain) {
|
|
85812
86024
|
process.stderr.write(
|
|
85813
|
-
|
|
86025
|
+
import_picocolors41.default.red(
|
|
85814
86026
|
`\u2715 --usdc/--gas/--chain go with an ADDRESS target (0x\u2026 or Solana base58); "${target}" reads as a bounty id.
|
|
85815
86027
|
`
|
|
85816
86028
|
)
|
|
@@ -85822,7 +86034,8 @@ program2.command("fund").description(
|
|
|
85822
86034
|
profile: opts.profile,
|
|
85823
86035
|
browserMode,
|
|
85824
86036
|
maxUsd: opts.maxUsd,
|
|
85825
|
-
json: opts.json
|
|
86037
|
+
json: opts.json,
|
|
86038
|
+
wallet: opts.wallet
|
|
85826
86039
|
});
|
|
85827
86040
|
});
|
|
85828
86041
|
program2.command("tip").description(
|
|
@@ -85830,7 +86043,7 @@ program2.command("tip").description(
|
|
|
85830
86043
|
).argument("<id>", "the bounty id (see agentgates list)").argument("<amount>", 'contribution in USDC display units (e.g. "5")').requiredOption(
|
|
85831
86044
|
"--user-stated <text>",
|
|
85832
86045
|
"the verbatim user request that triggered this tip (trust-gap defense)"
|
|
85833
|
-
).option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option("--max-usd <n>", "per-intent USD ceiling (default: amount + 1% price wobble)").option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (id2, amount, opts, command) => {
|
|
86046
|
+
).option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option("--max-usd <n>", "per-intent USD ceiling (default: amount + 1% price wobble)").option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (id2, amount, opts, command) => {
|
|
85834
86047
|
const browserSource = command.getOptionValueSource("browser");
|
|
85835
86048
|
let browserMode = "auto";
|
|
85836
86049
|
if (browserSource === "cli") {
|
|
@@ -85841,7 +86054,8 @@ program2.command("tip").description(
|
|
|
85841
86054
|
profile: opts.profile,
|
|
85842
86055
|
browserMode,
|
|
85843
86056
|
maxUsd: opts.maxUsd,
|
|
85844
|
-
json: opts.json
|
|
86057
|
+
json: opts.json,
|
|
86058
|
+
wallet: opts.wallet
|
|
85845
86059
|
});
|
|
85846
86060
|
});
|
|
85847
86061
|
program2.command("subscribe").description(
|
|
@@ -85852,7 +86066,7 @@ program2.command("subscribe").description(
|
|
|
85852
86066
|
).option("--months <n>", "prepaid months: 1, 3 or 12 (default 1)").option("--profile <name>", "named profile (default: 'default')").option("--browser", "force open the approval URL (default unless --no-browser or CI=1)").option("--no-browser", "skip opening the approval URL").option(
|
|
85853
86067
|
"--max-usd <n>",
|
|
85854
86068
|
"your declared USD budget ceiling for this purchase (default: the pairing per-tx cap; the creator's price must fit under it)"
|
|
85855
|
-
).option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (creatorUserId, opts, command) => {
|
|
86069
|
+
).option("--wallet <name>", 'which of your wallets pays: its name (e.g. "Compute Treasury"), address or id; without it, your default wallet. agentgates wallets lists the ones this terminal may use').option("--json", "NDJSON output (one object per status flip + final terminal object)").action(async (creatorUserId, opts, command) => {
|
|
85856
86070
|
const browserSource = command.getOptionValueSource("browser");
|
|
85857
86071
|
let browserMode = "auto";
|
|
85858
86072
|
if (browserSource === "cli") {
|
|
@@ -85864,7 +86078,8 @@ program2.command("subscribe").description(
|
|
|
85864
86078
|
profile: opts.profile,
|
|
85865
86079
|
browserMode,
|
|
85866
86080
|
maxUsd: opts.maxUsd,
|
|
85867
|
-
json: opts.json
|
|
86081
|
+
json: opts.json,
|
|
86082
|
+
wallet: opts.wallet
|
|
85868
86083
|
});
|
|
85869
86084
|
});
|
|
85870
86085
|
var trade = program2.command("trade").description(
|
|
@@ -85932,7 +86147,7 @@ desk.command("sell").description("Sell desk coin credit back to the curve (sessi
|
|
|
85932
86147
|
program2.command("onboard").description("Welcome screen: look at what is for sale, or pair your wallet. Run by the installer.").option("--profile <name>", "named profile (default: 'default')").option("--lane <lane>", "which lane leads the menu: compute | inference | phone | email | passwords").action(async (opts) => {
|
|
85933
86148
|
await onboard(opts);
|
|
85934
86149
|
});
|
|
85935
|
-
var compute = program2.command("compute").description("
|
|
86150
|
+
var compute = program2.command("compute").description("Computers for AI swarms by the hour, confidential or plain, USDC per payment");
|
|
85936
86151
|
compute.command("plans").description("Live plans and the price ladder. Public read: no key, no account, no payment.").option("--json", "machine-readable output (the raw catalog)").action(async (opts) => {
|
|
85937
86152
|
await computePlans(opts);
|
|
85938
86153
|
});
|
|
@@ -85953,9 +86168,9 @@ compute.command("status <id>").description("One machine: status, endpoint, paid
|
|
|
85953
86168
|
compute.command("wait <id>").description("Wait until a machine runs, then print its endpoint. The clock starts when it runs.").option("--timeout <minutes>", "how long to wait (default 15)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (id2, opts) => {
|
|
85954
86169
|
await computeWait(id2, opts);
|
|
85955
86170
|
});
|
|
85956
|
-
var sandbox = program2.command("sandbox"
|
|
86171
|
+
var sandbox = program2.command("sandbox").description("Sealed sandboxes: a small Linux computer for one agent in a confidential VM, by the minute. Commands, files and secrets go straight to it, its proof checked first, every body sealed.");
|
|
85957
86172
|
var collect = (v, prev) => prev.concat(v);
|
|
85958
|
-
sandbox.command("create").description("Buy a sandbox: the price asked free, then x402 from this machine's key (USDC on an EVM network, no gas), its balance (--from-balance) or a compute key (--key). It answers running, or waits
|
|
86173
|
+
sandbox.command("create").description("Buy a sandbox: the price asked free, then x402 from this machine's key (USDC on an EVM network, no gas), its balance (--from-balance) or a compute key (--key). It answers running, or waits for a seat: about two minutes after its payment when a host must start for it.").option("--plan <id>", "a sandbox plan id (agentgates compute plans lists them)").option("--minutes <n>", "whole minutes of paid time; it starts when the sandbox runs").option("--hours <n>", "whole hours in place of --minutes").option("--image <image>", "base, python or node, or registry/name@sha256:<64 hex> (default base)").option("--count <n>", "2 to 10 sandboxes in one payment").option("--access-key", "make it with an access key this machine keeps (Authorization: Bearer at its door); always with --key").option("--from-balance", "draw this key's prepaid balance, no new payment (priced first, held to --max-usd)").option("--key <agc_key>", "draw this compute key's balance (priced first, held to --max-usd)").option("--network <name>", "pay on this network only").option("--max-usd <dollars>", "refuse to pay or draw above this price").option("--quote", "print the price and stop: nothing is paid or drawn").option("--yes", "pay without the prompt (with --max-usd)").option("--no-wait", "do not wait for a sandbox that waits for its host").option("--timeout <minutes>", "how long to wait for it (default 10)").option("--json", "machine-readable output (default when stdout is not a TTY)").action(async (opts) => {
|
|
85959
86174
|
await sandboxCreate(opts);
|
|
85960
86175
|
});
|
|
85961
86176
|
sandbox.command("exec <id> [command...]").description("Run a command in it, its output streamed, its receipt checked. Exit code: the command's; 124 out of time; 127 not started; 125 this CLI could not run it.").option("--shell <script>", "run this with /bin/sh -c in place of a command").option("--cwd <path>", "the folder it runs in (default /)").option("--env <KEY=VALUE>", "an env value for this run; repeatable", collect, []).option("--stdin <file>", "its standard input from a file (- for this one's), up to 512 KiB").option("--timeout <seconds>", "end it after this long (default 300)").option("--background", "leave it running; read it with agentgates sandbox logs").option("--key <agc_key>", "the compute key it was bought with (or AGENTGATES_COMPUTE_KEY)").option("--json", "the whole result as JSON at the end, in place of the stream").action(async (id2, command, opts) => {
|
|
@@ -86361,10 +86576,10 @@ mcp.command("install").description("Print the lines that add this server to Clau
|
|
|
86361
86576
|
mcpInstall();
|
|
86362
86577
|
});
|
|
86363
86578
|
program2.parseAsync(process.argv).catch((err) => {
|
|
86364
|
-
process.stderr.write(
|
|
86579
|
+
process.stderr.write(import_picocolors41.default.red(`\u2715 ${err.message}
|
|
86365
86580
|
`));
|
|
86366
86581
|
if (process.env.BOUNTY_DEBUG) {
|
|
86367
|
-
process.stderr.write(
|
|
86582
|
+
process.stderr.write(import_picocolors41.default.dim((err.stack ?? "") + "\n"));
|
|
86368
86583
|
}
|
|
86369
86584
|
process.exit(1);
|
|
86370
86585
|
});
|