@t2000/cli 5.26.0 → 5.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -33115,7 +33115,7 @@ function registerMcpStart(parent) {
|
|
|
33115
33115
|
parent.command("start", { isDefault: true }).description("Start MCP server (stdio transport \u2014 for AI client integration)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
33116
33116
|
let mod3;
|
|
33117
33117
|
try {
|
|
33118
|
-
mod3 = await import("./dist-
|
|
33118
|
+
mod3 = await import("./dist-JCY6PNWP.js");
|
|
33119
33119
|
} catch {
|
|
33120
33120
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
33121
33121
|
process.exit(1);
|
|
@@ -33455,13 +33455,93 @@ For MCP-aware clients (Claude Desktop, Cursor, Windsurf), prefer
|
|
|
33455
33455
|
}
|
|
33456
33456
|
|
|
33457
33457
|
// src/commands/agent/index.ts
|
|
33458
|
-
import { createHash as
|
|
33458
|
+
import { createHash as createHash3 } from "crypto";
|
|
33459
33459
|
|
|
33460
|
-
// src/commands/agent/
|
|
33460
|
+
// src/commands/agent/review.ts
|
|
33461
33461
|
import { createHash } from "crypto";
|
|
33462
|
+
var DEFAULT_GATEWAY = "https://x402.t2000.ai";
|
|
33463
|
+
async function fetchJson(url, init) {
|
|
33464
|
+
const res = await fetch(url, {
|
|
33465
|
+
method: init?.method ?? "GET",
|
|
33466
|
+
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
33467
|
+
body: init?.body ? JSON.stringify(init.body) : void 0
|
|
33468
|
+
});
|
|
33469
|
+
const json = await res.json().catch(() => ({}));
|
|
33470
|
+
if (!res.ok) {
|
|
33471
|
+
const err = json.error;
|
|
33472
|
+
throw new Error(typeof err === "string" ? err : `HTTP ${res.status}`);
|
|
33473
|
+
}
|
|
33474
|
+
return json;
|
|
33475
|
+
}
|
|
33476
|
+
function reviewMessage(digest, stars, text, timestamp) {
|
|
33477
|
+
const hash = createHash("sha256").update(text, "utf8").digest("hex");
|
|
33478
|
+
return `t2000-review:${digest}:${stars}:${hash}:${timestamp}`;
|
|
33479
|
+
}
|
|
33480
|
+
function registerAgentReview(agent) {
|
|
33481
|
+
agent.command("review").description(
|
|
33482
|
+
"Review a purchase (1-5 stars + optional text). Binds to your latest settled receipt with the seller, or --digest for a specific one. Re-run to edit. [Store v2]"
|
|
33483
|
+
).argument("<seller>", "Seller address (0x\u2026)").requiredOption("--stars <n>", "Rating 1-5").option("--text <text>", "Review text (\u2264400 chars)").option("--digest <digest>", "Collect digest of the specific purchase").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
33484
|
+
async (seller, opts) => {
|
|
33485
|
+
try {
|
|
33486
|
+
const stars = Number(opts.stars);
|
|
33487
|
+
if (!Number.isInteger(stars) || stars < 1 || stars > 5) {
|
|
33488
|
+
throw new Error("--stars must be an integer 1-5.");
|
|
33489
|
+
}
|
|
33490
|
+
const text = (opts.text ?? "").trim();
|
|
33491
|
+
if (text.length > 400) {
|
|
33492
|
+
throw new Error("--text must be \u2264 400 chars.");
|
|
33493
|
+
}
|
|
33494
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY;
|
|
33495
|
+
const agentW = await withAgent({ keyPath: opts.key });
|
|
33496
|
+
const buyer = agentW.address();
|
|
33497
|
+
let digest = (opts.digest ?? "").trim();
|
|
33498
|
+
if (!digest) {
|
|
33499
|
+
const res = await fetchJson(
|
|
33500
|
+
`${gateway}/commerce/review?buyer=${buyer}&seller=${encodeURIComponent(seller)}`
|
|
33501
|
+
);
|
|
33502
|
+
const reviewable = res.reviewable ?? [];
|
|
33503
|
+
if (reviewable.length === 0) {
|
|
33504
|
+
throw new Error(
|
|
33505
|
+
"No settled purchase from this wallet to that seller \u2014 buy first (`t2 agent pay`), then review."
|
|
33506
|
+
);
|
|
33507
|
+
}
|
|
33508
|
+
digest = reviewable[0].digest;
|
|
33509
|
+
}
|
|
33510
|
+
const timestamp = Date.now();
|
|
33511
|
+
const message = new TextEncoder().encode(
|
|
33512
|
+
reviewMessage(digest, stars, text, timestamp)
|
|
33513
|
+
);
|
|
33514
|
+
const { signature } = await agentW.keypair.signPersonalMessage(message);
|
|
33515
|
+
await fetchJson(`${gateway}/commerce/review`, {
|
|
33516
|
+
method: "POST",
|
|
33517
|
+
body: { digest, stars, text, timestamp, signature }
|
|
33518
|
+
});
|
|
33519
|
+
if (isJsonMode()) {
|
|
33520
|
+
printJson({ ok: true, digest, stars, text: text || null });
|
|
33521
|
+
return;
|
|
33522
|
+
}
|
|
33523
|
+
printBlank();
|
|
33524
|
+
printSuccess(
|
|
33525
|
+
`Review posted \u2014 ${"\u2605".repeat(stars)}${"\u2606".repeat(5 - stars)}${text ? ` "${text}"` : ""}`
|
|
33526
|
+
);
|
|
33527
|
+
printKeyValue("Receipt", digest);
|
|
33528
|
+
printKeyValue(
|
|
33529
|
+
"Listing",
|
|
33530
|
+
`https://agents.t2000.ai/${seller.startsWith("0x") ? seller : ""}`
|
|
33531
|
+
);
|
|
33532
|
+
printBlank();
|
|
33533
|
+
} catch (e) {
|
|
33534
|
+
handleError(e);
|
|
33535
|
+
}
|
|
33536
|
+
}
|
|
33537
|
+
);
|
|
33538
|
+
}
|
|
33539
|
+
|
|
33540
|
+
// src/commands/agent/services.ts
|
|
33541
|
+
import { createHash as createHash2 } from "crypto";
|
|
33462
33542
|
import { readFileSync as readFileSync3 } from "fs";
|
|
33463
33543
|
var SLUG_RE = /^[a-z0-9][a-z0-9-]{1,39}$/;
|
|
33464
|
-
async function
|
|
33544
|
+
async function fetchJson2(url, init) {
|
|
33465
33545
|
const res = await fetch(url, {
|
|
33466
33546
|
method: init?.method ?? "GET",
|
|
33467
33547
|
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
@@ -33485,7 +33565,7 @@ function canonicalServicesJson(services) {
|
|
|
33485
33565
|
);
|
|
33486
33566
|
}
|
|
33487
33567
|
async function getCatalog(base, address) {
|
|
33488
|
-
const res = await
|
|
33568
|
+
const res = await fetchJson2(
|
|
33489
33569
|
`${base}/agent/services?address=${encodeURIComponent(address)}`
|
|
33490
33570
|
);
|
|
33491
33571
|
return Array.isArray(res.services) ? res.services : [];
|
|
@@ -33493,7 +33573,7 @@ async function getCatalog(base, address) {
|
|
|
33493
33573
|
async function putCatalog(opts) {
|
|
33494
33574
|
const agent = await withAgent({ keyPath: opts.keyPath });
|
|
33495
33575
|
const address = agent.address();
|
|
33496
|
-
const challenge = await
|
|
33576
|
+
const challenge = await fetchJson2(`${opts.base}/agent/challenge`, {
|
|
33497
33577
|
method: "POST",
|
|
33498
33578
|
body: { address }
|
|
33499
33579
|
});
|
|
@@ -33501,12 +33581,12 @@ async function putCatalog(opts) {
|
|
|
33501
33581
|
if (!nonce) {
|
|
33502
33582
|
throw new Error("Failed to get a challenge nonce.");
|
|
33503
33583
|
}
|
|
33504
|
-
const digest =
|
|
33584
|
+
const digest = createHash2("sha256").update(canonicalServicesJson(opts.services)).digest("hex");
|
|
33505
33585
|
const message = new TextEncoder().encode(
|
|
33506
33586
|
`t2000-agent-services:${nonce}:${digest}`
|
|
33507
33587
|
);
|
|
33508
33588
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33509
|
-
const res = await
|
|
33589
|
+
const res = await fetchJson2(`${opts.base}/agent/services`, {
|
|
33510
33590
|
method: "POST",
|
|
33511
33591
|
body: { address, nonce, signature, services: opts.services }
|
|
33512
33592
|
});
|
|
@@ -33687,7 +33767,7 @@ function registerAgentServices(agentGroup, defaults) {
|
|
|
33687
33767
|
|
|
33688
33768
|
// src/commands/agent/index.ts
|
|
33689
33769
|
var DEFAULT_API_BASE3 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
33690
|
-
var
|
|
33770
|
+
var DEFAULT_GATEWAY2 = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
33691
33771
|
var DEFAULT_RAIL = process.env.T2000_RAIL_URL ?? "https://x402.t2000.ai";
|
|
33692
33772
|
var AGENT_CATEGORIES = [
|
|
33693
33773
|
"ai-models",
|
|
@@ -33726,19 +33806,19 @@ async function fundCredit(agent, base, amountStr, assetOpt) {
|
|
|
33726
33806
|
throw new Error(`amount must be a positive number (got "${amountStr}").`);
|
|
33727
33807
|
}
|
|
33728
33808
|
const asset = normalizeTopupAsset(assetOpt);
|
|
33729
|
-
const cfg = await
|
|
33809
|
+
const cfg = await fetchJson3(`${base}/agent/topup`, { method: "GET" });
|
|
33730
33810
|
const treasury = cfg.treasury;
|
|
33731
33811
|
if (!treasury) {
|
|
33732
33812
|
throw new Error("Could not resolve the t2000 treasury address.");
|
|
33733
33813
|
}
|
|
33734
33814
|
const sent = await agent.send({ to: treasury, amount, asset });
|
|
33735
|
-
const topup = await
|
|
33815
|
+
const topup = await fetchJson3(`${base}/agent/topup`, {
|
|
33736
33816
|
method: "POST",
|
|
33737
33817
|
body: { address: agent.address(), digest: sent.tx }
|
|
33738
33818
|
});
|
|
33739
33819
|
return { amount, asset, balanceUsd: topup.balanceUsd };
|
|
33740
33820
|
}
|
|
33741
|
-
async function
|
|
33821
|
+
async function fetchJson3(url, init) {
|
|
33742
33822
|
const res = await fetch(url, {
|
|
33743
33823
|
method: init.method,
|
|
33744
33824
|
headers: init.body ? { "Content-Type": "application/json" } : void 0,
|
|
@@ -33765,6 +33845,7 @@ Subcommands:
|
|
|
33765
33845
|
`
|
|
33766
33846
|
);
|
|
33767
33847
|
registerAgentServices(group, { apiBase: DEFAULT_API_BASE3 });
|
|
33848
|
+
registerAgentReview(group);
|
|
33768
33849
|
group.command("onboard").description(
|
|
33769
33850
|
"Buy-side setup: fund credit (gasless USDC/USDsui) + mint a Private API key. Registering an Agent ID is free and separate \u2014 `t2 init` / `t2 agent register`."
|
|
33770
33851
|
).option("--fund <amount>", "Stablecoin amount to deposit as credit (omit if already funded)").option("--asset <asset>", "USDC (default) or USDsui", "USDC").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE3})`).action(
|
|
@@ -33781,7 +33862,7 @@ Subcommands:
|
|
|
33781
33862
|
);
|
|
33782
33863
|
}
|
|
33783
33864
|
}
|
|
33784
|
-
const challenge = await
|
|
33865
|
+
const challenge = await fetchJson3(`${base}/agent/challenge`, {
|
|
33785
33866
|
method: "POST",
|
|
33786
33867
|
body: { address }
|
|
33787
33868
|
});
|
|
@@ -33791,7 +33872,7 @@ Subcommands:
|
|
|
33791
33872
|
}
|
|
33792
33873
|
const message = new TextEncoder().encode(`t2000-agent-keys:${nonce}`);
|
|
33793
33874
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33794
|
-
const minted = await
|
|
33875
|
+
const minted = await fetchJson3(`${base}/agent/keys`, {
|
|
33795
33876
|
method: "POST",
|
|
33796
33877
|
body: { address, nonce, signature }
|
|
33797
33878
|
});
|
|
@@ -33961,7 +34042,7 @@ Subcommands:
|
|
|
33961
34042
|
const base = opts.api ?? DEFAULT_API_BASE3;
|
|
33962
34043
|
const agent = await withAgent({ keyPath: opts.key });
|
|
33963
34044
|
const address = agent.address();
|
|
33964
|
-
const challenge = await
|
|
34045
|
+
const challenge = await fetchJson3(`${base}/agent/challenge`, {
|
|
33965
34046
|
method: "POST",
|
|
33966
34047
|
body: { address }
|
|
33967
34048
|
});
|
|
@@ -33971,7 +34052,7 @@ Subcommands:
|
|
|
33971
34052
|
}
|
|
33972
34053
|
const message = new TextEncoder().encode(`t2000-agent-profile:${nonce}`);
|
|
33973
34054
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
33974
|
-
await
|
|
34055
|
+
await fetchJson3(`${base}/agent/profile`, {
|
|
33975
34056
|
method: "POST",
|
|
33976
34057
|
body: {
|
|
33977
34058
|
address,
|
|
@@ -34081,11 +34162,11 @@ Subcommands:
|
|
|
34081
34162
|
).option("--remove", "Take down the deployed service").option(
|
|
34082
34163
|
"--service <slug>",
|
|
34083
34164
|
"Catalog service slug \u2014 wrap config for ONE SKU (Store v2; omit = the default service)"
|
|
34084
|
-
).option("--gateway <url>", `Gateway base URL (default ${
|
|
34165
|
+
).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE3})`).action(
|
|
34085
34166
|
async (opts) => {
|
|
34086
34167
|
try {
|
|
34087
34168
|
const base = opts.api ?? DEFAULT_API_BASE3;
|
|
34088
|
-
const gateway = opts.gateway ??
|
|
34169
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34089
34170
|
const category = normalizeCategory(opts.category);
|
|
34090
34171
|
const slug = opts.service?.trim().toLowerCase() || void 0;
|
|
34091
34172
|
const agent = await withAgent({ keyPath: opts.key });
|
|
@@ -34096,7 +34177,7 @@ Subcommands:
|
|
|
34096
34177
|
const { signature: signature2 } = await agent.keypair.signPersonalMessage(
|
|
34097
34178
|
new TextEncoder().encode(msg2)
|
|
34098
34179
|
);
|
|
34099
|
-
await
|
|
34180
|
+
await fetchJson3(`${gateway}/deploy/config`, {
|
|
34100
34181
|
method: "DELETE",
|
|
34101
34182
|
body: { address, timestamp: ts2, signature: signature2, ...slug ? { slug } : {} }
|
|
34102
34183
|
});
|
|
@@ -34128,14 +34209,14 @@ Subcommands:
|
|
|
34128
34209
|
const method = (opts.method ?? "POST").toUpperCase() === "GET" ? "GET" : "POST";
|
|
34129
34210
|
const headers = opts.header ?? {};
|
|
34130
34211
|
const ts = Date.now();
|
|
34131
|
-
const bodyHash =
|
|
34212
|
+
const bodyHash = createHash3("sha256").update(
|
|
34132
34213
|
`${opts.upstream}|${method}|${JSON.stringify(headers)}${slug ? `|${slug}` : ""}`
|
|
34133
34214
|
).digest("hex");
|
|
34134
34215
|
const msg = `t2000-deploy:${ts}:${bodyHash}`;
|
|
34135
34216
|
const { signature } = await agent.keypair.signPersonalMessage(
|
|
34136
34217
|
new TextEncoder().encode(msg)
|
|
34137
34218
|
);
|
|
34138
|
-
await
|
|
34219
|
+
await fetchJson3(`${gateway}/deploy/config`, {
|
|
34139
34220
|
method: "POST",
|
|
34140
34221
|
body: {
|
|
34141
34222
|
address,
|
|
@@ -34204,7 +34285,7 @@ Subcommands:
|
|
|
34204
34285
|
"Catalog service slug \u2014 buys ONE SKU of the seller's catalog (Store v2)"
|
|
34205
34286
|
).option(
|
|
34206
34287
|
"--gateway <url>",
|
|
34207
|
-
`Gateway base URL (default ${
|
|
34288
|
+
`Gateway base URL (default ${DEFAULT_GATEWAY2})`
|
|
34208
34289
|
).option("--force", "Override spending limits for this call (see `t2 limit`)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34209
34290
|
async (seller, opts) => {
|
|
34210
34291
|
try {
|
|
@@ -34215,7 +34296,7 @@ Subcommands:
|
|
|
34215
34296
|
}
|
|
34216
34297
|
}
|
|
34217
34298
|
const maxPrice = opts.maxPrice ? Number.parseFloat(opts.maxPrice) : opts.amount ? Number.parseFloat(opts.amount) : 1;
|
|
34218
|
-
const gateway = opts.gateway ??
|
|
34299
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34219
34300
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34220
34301
|
const resolvedSeller = seller.startsWith("0x") ? seller : (await agent.resolveRecipient(seller)).address;
|
|
34221
34302
|
const slugPath = opts.service ? `/${opts.service.trim().toLowerCase()}` : "";
|
|
@@ -34283,12 +34364,12 @@ Subcommands:
|
|
|
34283
34364
|
);
|
|
34284
34365
|
group.command("earnings").description(
|
|
34285
34366
|
"Your sales as a seller \u2014 count, USDC earned (net), and unique buyers, from the on-chain settlement ledger. [Agent Commerce]"
|
|
34286
|
-
).option("--gateway <url>", `Gateway base URL (default ${
|
|
34367
|
+
).option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY2})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(async (opts) => {
|
|
34287
34368
|
try {
|
|
34288
|
-
const gateway = opts.gateway ??
|
|
34369
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY2;
|
|
34289
34370
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34290
34371
|
const address = agent.address();
|
|
34291
|
-
const stats = await
|
|
34372
|
+
const stats = await fetchJson3(
|
|
34292
34373
|
`${gateway}/commerce/stats/${address}`,
|
|
34293
34374
|
{ method: "GET" }
|
|
34294
34375
|
);
|
|
@@ -34317,7 +34398,7 @@ Subcommands:
|
|
|
34317
34398
|
const base = opts.api ?? DEFAULT_API_BASE3;
|
|
34318
34399
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34319
34400
|
const address = agent.address();
|
|
34320
|
-
const challenge = await
|
|
34401
|
+
const challenge = await fetchJson3(`${base}/agent/challenge`, {
|
|
34321
34402
|
method: "POST",
|
|
34322
34403
|
body: { address }
|
|
34323
34404
|
});
|
|
@@ -34329,7 +34410,7 @@ Subcommands:
|
|
|
34329
34410
|
const message = new TextEncoder().encode(`${action}:${nonce}:${label}`);
|
|
34330
34411
|
const { signature } = await agent.keypair.signPersonalMessage(message);
|
|
34331
34412
|
const path2 = opts.release ? "/agent/handle/release" : "/agent/handle";
|
|
34332
|
-
const res = await
|
|
34413
|
+
const res = await fetchJson3(`${base}${path2}`, {
|
|
34333
34414
|
method: "POST",
|
|
34334
34415
|
body: { address, label, nonce, signature }
|
|
34335
34416
|
});
|
|
@@ -34446,7 +34527,7 @@ function registerAgents(program3) {
|
|
|
34446
34527
|
}
|
|
34447
34528
|
|
|
34448
34529
|
// src/commands/task/index.ts
|
|
34449
|
-
var
|
|
34530
|
+
var DEFAULT_GATEWAY3 = process.env.T2000_GATEWAY_URL ?? "https://mpp.t2000.ai";
|
|
34450
34531
|
async function getJson2(url) {
|
|
34451
34532
|
const res = await fetch(url, { headers: { accept: "application/json" } });
|
|
34452
34533
|
const json = await res.json().catch(() => ({}));
|
|
@@ -34471,9 +34552,9 @@ function registerTask(program3) {
|
|
|
34471
34552
|
const group = program3.command("task").description(
|
|
34472
34553
|
"Earn from t2000 reward tasks and work (or post) community board tasks \u2014 all paid through the rail. [Agent Commerce]"
|
|
34473
34554
|
);
|
|
34474
|
-
group.command("list").description("Live tasks: t2000 rewards (auto-verified) + the community board (poster-approved)").option("--gateway <url>", `Gateway base URL (default ${
|
|
34555
|
+
group.command("list").description("Live tasks: t2000 rewards (auto-verified) + the community board (poster-approved)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).action(async (opts) => {
|
|
34475
34556
|
try {
|
|
34476
|
-
const gateway = opts.gateway ??
|
|
34557
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34477
34558
|
const [rewards, board] = await Promise.all([
|
|
34478
34559
|
getJson2(`${gateway}/tasks/stats`),
|
|
34479
34560
|
getJson2(`${gateway}/tasks/board`)
|
|
@@ -34507,10 +34588,10 @@ function registerTask(program3) {
|
|
|
34507
34588
|
handleError(error);
|
|
34508
34589
|
}
|
|
34509
34590
|
});
|
|
34510
|
-
group.command("claim").argument("<task>", "Reward task id (e.g. buy-sui, share-a-read) \u2014 see `t2 task list`").description("Claim a t2000 reward task (verified in one request; also retries automated tasks)").option("--tx <digest>", "Swap tx digest (buy-manifest / buy-sui)").option("--post <url>", "Your X post URL (X-proof tasks)").option("--gateway <url>", `Gateway base URL (default ${
|
|
34591
|
+
group.command("claim").argument("<task>", "Reward task id (e.g. buy-sui, share-a-read) \u2014 see `t2 task list`").description("Claim a t2000 reward task (verified in one request; also retries automated tasks)").option("--tx <digest>", "Swap tx digest (buy-manifest / buy-sui)").option("--post <url>", "Your X post URL (X-proof tasks)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34511
34592
|
async (task, opts) => {
|
|
34512
34593
|
try {
|
|
34513
|
-
const gateway = opts.gateway ??
|
|
34594
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34514
34595
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34515
34596
|
const result = await postJson2(`${gateway}/tasks/claim`, {
|
|
34516
34597
|
task,
|
|
@@ -34539,10 +34620,10 @@ function registerTask(program3) {
|
|
|
34539
34620
|
);
|
|
34540
34621
|
group.command("post").description(
|
|
34541
34622
|
"Post a community task \u2014 pays the FULL budget (reward \xD7 completions) into escrow via x402; auto-moderated at post time. SAVE the returned manageKey."
|
|
34542
|
-
).requiredOption("--title <text>", "What needs doing (8+ chars)").requiredOption("--description <text>", "Exactly what the worker must deliver + what proof (30+ chars)").requiredOption("--reward <usdc>", "Reward per approved completion ($0.01\u2013$50)").option("--completions <n>", "Max completions (default 1)", "1").option("--expiry-days <n>", "Days until unspent budget auto-refunds (default 7)", "7").option("--category <category>", "research | data | marketing | dev | creative | other", "other").option("--notify-email <email>", "Email me when submissions arrive + when the refund settles (per-task, one-click stop in every mail)").option("--gateway <url>", `Gateway base URL (default ${
|
|
34623
|
+
).requiredOption("--title <text>", "What needs doing (8+ chars)").requiredOption("--description <text>", "Exactly what the worker must deliver + what proof (30+ chars)").requiredOption("--reward <usdc>", "Reward per approved completion ($0.01\u2013$50)").option("--completions <n>", "Max completions (default 1)", "1").option("--expiry-days <n>", "Days until unspent budget auto-refunds (default 7)", "7").option("--category <category>", "research | data | marketing | dev | creative | other", "other").option("--notify-email <email>", "Email me when submissions arrive + when the refund settles (per-task, one-click stop in every mail)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).option("--force", "Override spending limits for this call (see `t2 limit`)").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34543
34624
|
async (opts) => {
|
|
34544
34625
|
try {
|
|
34545
|
-
const gateway = opts.gateway ??
|
|
34626
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34546
34627
|
const reward = Number.parseFloat(opts.reward);
|
|
34547
34628
|
const completions = Number.parseInt(opts.completions, 10);
|
|
34548
34629
|
if (!Number.isFinite(reward) || reward <= 0) {
|
|
@@ -34591,10 +34672,10 @@ function registerTask(program3) {
|
|
|
34591
34672
|
}
|
|
34592
34673
|
}
|
|
34593
34674
|
);
|
|
34594
|
-
group.command("submit").argument("<taskId>", "Board task id (see `t2 task list`)").description("Submit proof of completion to a board task (one submission per wallet)").requiredOption("--proof <text>", "What you did + how the poster can verify it (10+ chars)").option("--url <url>", "Proof link (https)").option("--gateway <url>", `Gateway base URL (default ${
|
|
34675
|
+
group.command("submit").argument("<taskId>", "Board task id (see `t2 task list`)").description("Submit proof of completion to a board task (one submission per wallet)").requiredOption("--proof <text>", "What you did + how the poster can verify it (10+ chars)").option("--url <url>", "Proof link (https)").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").action(
|
|
34595
34676
|
async (taskId, opts) => {
|
|
34596
34677
|
try {
|
|
34597
|
-
const gateway = opts.gateway ??
|
|
34678
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34598
34679
|
const agent = await withAgent({ keyPath: opts.key });
|
|
34599
34680
|
const result = await postJson2(
|
|
34600
34681
|
`${gateway}/tasks/board/${taskId}/submit`,
|
|
@@ -34616,9 +34697,9 @@ function registerTask(program3) {
|
|
|
34616
34697
|
}
|
|
34617
34698
|
}
|
|
34618
34699
|
);
|
|
34619
|
-
group.command("review").argument("<taskId>", "Your board task id").description("List submissions on your board task (poster view \u2014 needs the manageKey)").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${
|
|
34700
|
+
group.command("review").argument("<taskId>", "Your board task id").description("List submissions on your board task (poster view \u2014 needs the manageKey)").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).action(async (taskId, opts) => {
|
|
34620
34701
|
try {
|
|
34621
|
-
const gateway = opts.gateway ??
|
|
34702
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34622
34703
|
const result = await getJson2(`${gateway}/tasks/board/${taskId}?manageKey=${encodeURIComponent(opts.manageKey)}`);
|
|
34623
34704
|
if (!result.posterView) {
|
|
34624
34705
|
throw new Error(result.error ?? "manageKey not accepted for this task.");
|
|
@@ -34646,10 +34727,10 @@ function registerTask(program3) {
|
|
|
34646
34727
|
handleError(error);
|
|
34647
34728
|
}
|
|
34648
34729
|
});
|
|
34649
|
-
group.command("approve").argument("<taskId>", "Your board task id").description("Approve (pay) or reject submissions on your board task \u2014 batch up to 50").requiredOption("--manage-key <key>", "The manageKey returned when you posted").requiredOption("--submissions <ids>", "Comma-separated submission ids").option("--reject", "Reject instead of approving").option("--gateway <url>", `Gateway base URL (default ${
|
|
34730
|
+
group.command("approve").argument("<taskId>", "Your board task id").description("Approve (pay) or reject submissions on your board task \u2014 batch up to 50").requiredOption("--manage-key <key>", "The manageKey returned when you posted").requiredOption("--submissions <ids>", "Comma-separated submission ids").option("--reject", "Reject instead of approving").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).action(
|
|
34650
34731
|
async (taskId, opts) => {
|
|
34651
34732
|
try {
|
|
34652
|
-
const gateway = opts.gateway ??
|
|
34733
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34653
34734
|
const result = await postJson2(`${gateway}/tasks/board/${taskId}/approve`, {
|
|
34654
34735
|
manageKey: opts.manageKey,
|
|
34655
34736
|
submissionIds: opts.submissions.split(",").map((s) => s.trim()).filter(Boolean),
|
|
@@ -34675,9 +34756,9 @@ function registerTask(program3) {
|
|
|
34675
34756
|
}
|
|
34676
34757
|
}
|
|
34677
34758
|
);
|
|
34678
|
-
group.command("close").argument("<taskId>", "Your board task id").description("Close your board task early \u2014 the unspent budget refunds to your wallet").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${
|
|
34759
|
+
group.command("close").argument("<taskId>", "Your board task id").description("Close your board task early \u2014 the unspent budget refunds to your wallet").requiredOption("--manage-key <key>", "The manageKey returned when you posted").option("--gateway <url>", `Gateway base URL (default ${DEFAULT_GATEWAY3})`).action(async (taskId, opts) => {
|
|
34679
34760
|
try {
|
|
34680
|
-
const gateway = opts.gateway ??
|
|
34761
|
+
const gateway = opts.gateway ?? DEFAULT_GATEWAY3;
|
|
34681
34762
|
const result = await postJson2(`${gateway}/tasks/board/${taskId}/close`, { manageKey: opts.manageKey });
|
|
34682
34763
|
if (isJsonMode()) {
|
|
34683
34764
|
printJson(result);
|