@t2000/cli 9.10.0 → 9.11.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
|
@@ -23370,7 +23370,7 @@ function registerMcpStart(parent) {
|
|
|
23370
23370
|
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) => {
|
|
23371
23371
|
let mod;
|
|
23372
23372
|
try {
|
|
23373
|
-
mod = await import("./dist-
|
|
23373
|
+
mod = await import("./dist-LRBJUCHL.js");
|
|
23374
23374
|
} catch {
|
|
23375
23375
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
23376
23376
|
process.exit(1);
|
|
@@ -24624,6 +24624,29 @@ function printJob(job, me) {
|
|
|
24624
24624
|
if (job.deliveryHash) printKeyValue("Delivery hash", job.deliveryHash);
|
|
24625
24625
|
printKeyValue("Reject split", `${job.rejectSplitBps / 100}% buyer / ${(1e4 - job.rejectSplitBps) / 100}% seller`);
|
|
24626
24626
|
}
|
|
24627
|
+
async function fetchSellerJobs(base, seller) {
|
|
24628
|
+
const json = await fetchJson3(`${base}/jobs?seller=${encodeURIComponent(seller)}&limit=100`);
|
|
24629
|
+
return json.jobs ?? [];
|
|
24630
|
+
}
|
|
24631
|
+
var TERMINAL_STATES = /* @__PURE__ */ new Set(["released", "rejected", "refunded"]);
|
|
24632
|
+
function inboxHint(job) {
|
|
24633
|
+
if (job.state === "funded") {
|
|
24634
|
+
return `t2 job spec ${truncateAddress(job.jobId)} \u2192 do the work \u2192 t2 job deliver ${truncateAddress(job.jobId)} <file>`;
|
|
24635
|
+
}
|
|
24636
|
+
if (job.state === "delivered") {
|
|
24637
|
+
return `waiting on the buyer's review \u2014 anyone can \`t2 job release\` once it lapses`;
|
|
24638
|
+
}
|
|
24639
|
+
return "";
|
|
24640
|
+
}
|
|
24641
|
+
function printInboxRow(job) {
|
|
24642
|
+
const deadline = job.state === "funded" ? ` \xB7 deliver by ${new Date(job.deliverByMs).toISOString()}` : "";
|
|
24643
|
+
printLine(
|
|
24644
|
+
` ${stateColor(job.state)} $${job.amountUsdc.toFixed(2)} USDC \xB7 from ${truncateAddress(job.buyer)}${deadline}`
|
|
24645
|
+
);
|
|
24646
|
+
printLine(` ${import_picocolors15.default.dim(job.jobId)}`);
|
|
24647
|
+
const hint = inboxHint(job);
|
|
24648
|
+
if (hint) printLine(` ${import_picocolors15.default.dim("\u2192")} ${hint}`);
|
|
24649
|
+
}
|
|
24627
24650
|
async function sponsoredJobVerb(opts) {
|
|
24628
24651
|
const agent = await withAgent({ keyPath: opts.keyPath });
|
|
24629
24652
|
const address = agent.address();
|
|
@@ -24654,6 +24677,7 @@ Typical flow:
|
|
|
24654
24677
|
seller $ t2 job deliver 0xJOB report.pdf
|
|
24655
24678
|
buyer $ t2 job release 0xJOB (or: t2 job reject 0xJOB)
|
|
24656
24679
|
either $ t2 job watch 0xJOB
|
|
24680
|
+
seller $ t2 job watch --mine (the provider inbox \u2014 all your jobs)
|
|
24657
24681
|
|
|
24658
24682
|
Buying an OFFERING (t2 ACP) \u2014 price + terms come from the listing:
|
|
24659
24683
|
buyer $ t2 browse "market report"
|
|
@@ -24904,12 +24928,62 @@ Buying an OFFERING (t2 ACP) \u2014 price + terms come from the listing:
|
|
|
24904
24928
|
handleError(error);
|
|
24905
24929
|
}
|
|
24906
24930
|
});
|
|
24907
|
-
group.command("watch").argument("
|
|
24931
|
+
group.command("watch").argument("[jobId]", "The Job object id (0x\u2026) \u2014 omit with --mine").description("Poll a job \u2014 or, with --mine, the provider inbox (every job selling to you)").option("--mine", "Watch ALL jobs where this wallet is the seller (the provider inbox)").option("--interval <seconds>", "Poll interval", "15").option("--once", "Print the current state and exit").option("--key <path>", "Custom wallet path (default ~/.t2000/wallet.key)").option("--api <url>", `API base URL (default ${DEFAULT_API_BASE5})`).action(async (jobId, opts) => {
|
|
24908
24932
|
try {
|
|
24909
24933
|
const agent = await withAgent({ keyPath: opts.key });
|
|
24910
24934
|
const me = agent.address();
|
|
24911
|
-
const client = getSuiClient();
|
|
24912
24935
|
const intervalMs = Math.max(5, Number.parseInt(opts.interval, 10) || 15) * 1e3;
|
|
24936
|
+
if (opts.mine) {
|
|
24937
|
+
const base = opts.api ?? DEFAULT_API_BASE5;
|
|
24938
|
+
const seen = /* @__PURE__ */ new Map();
|
|
24939
|
+
const jobs = await fetchSellerJobs(base, me);
|
|
24940
|
+
if (isJsonMode()) {
|
|
24941
|
+
printJson({ seller: me, jobs });
|
|
24942
|
+
return;
|
|
24943
|
+
}
|
|
24944
|
+
const open = jobs.filter((j) => !TERMINAL_STATES.has(j.state));
|
|
24945
|
+
printBlank();
|
|
24946
|
+
printInfo(`Provider inbox for ${truncateAddress(me)} \u2014 ${jobs.length} job(s), ${open.length} open.`);
|
|
24947
|
+
printBlank();
|
|
24948
|
+
for (const job of open) {
|
|
24949
|
+
printInboxRow(job);
|
|
24950
|
+
printBlank();
|
|
24951
|
+
}
|
|
24952
|
+
if (open.length === 0) {
|
|
24953
|
+
printInfo("No open jobs. New hires appear here the moment the escrow funds.");
|
|
24954
|
+
printBlank();
|
|
24955
|
+
}
|
|
24956
|
+
for (const job of jobs) seen.set(job.jobId, job.state);
|
|
24957
|
+
if (opts.once) return;
|
|
24958
|
+
for (; ; ) {
|
|
24959
|
+
await new Promise((r) => setTimeout(r, intervalMs));
|
|
24960
|
+
let latest;
|
|
24961
|
+
try {
|
|
24962
|
+
latest = await fetchSellerJobs(base, me);
|
|
24963
|
+
} catch {
|
|
24964
|
+
continue;
|
|
24965
|
+
}
|
|
24966
|
+
for (const job of latest) {
|
|
24967
|
+
const prev = seen.get(job.jobId);
|
|
24968
|
+
if (prev === job.state) continue;
|
|
24969
|
+
seen.set(job.jobId, job.state);
|
|
24970
|
+
printBlank();
|
|
24971
|
+
if (prev === void 0 && job.state === "funded") {
|
|
24972
|
+
printSuccess(`New job \u2014 $${job.amountUsdc.toFixed(2)} USDC escrowed for you.`);
|
|
24973
|
+
} else {
|
|
24974
|
+
printInfo(`Job ${truncateAddress(job.jobId)}: ${prev ?? "new"} \u2192 ${job.state}`);
|
|
24975
|
+
}
|
|
24976
|
+
printInboxRow(job);
|
|
24977
|
+
printBlank();
|
|
24978
|
+
}
|
|
24979
|
+
}
|
|
24980
|
+
}
|
|
24981
|
+
if (!jobId) {
|
|
24982
|
+
printError("Provide a job id \u2014 or use --mine for the provider inbox.");
|
|
24983
|
+
process.exitCode = 1;
|
|
24984
|
+
return;
|
|
24985
|
+
}
|
|
24986
|
+
const client = getSuiClient();
|
|
24913
24987
|
for (; ; ) {
|
|
24914
24988
|
const job = await getJob(client, jobId);
|
|
24915
24989
|
const actions = jobActionsFor(job, me);
|