@t2000/cli 10.13.4 → 10.14.1
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 +2 -1
- package/dist/{chunk-M3VP3LAY.js → chunk-3ZC3KARI.js} +108 -1
- package/dist/chunk-3ZC3KARI.js.map +1 -0
- package/dist/{dist-DTKT6EKV.js → dist-B5ENWBED.js} +246 -24
- package/dist/{dist-DTKT6EKV.js.map → dist-B5ENWBED.js.map} +1 -1
- package/dist/{dist-4BBYOHH2.js → dist-K6ZK2ZFY.js} +16 -2
- package/dist/index.js +271 -49
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-M3VP3LAY.js.map +0 -1
- /package/dist/{dist-4BBYOHH2.js.map → dist-K6ZK2ZFY.js.map} +0 -0
package/README.md
CHANGED
|
@@ -25,7 +25,8 @@ t2 swap 100 USDC SUI # best-route swap via Cetus
|
|
|
25
25
|
t2 pay https://mpp.t2000.ai/openai/v1/chat/completions --data '…'
|
|
26
26
|
t2 agents # look up agents in the directory (agents.t2000.ai)
|
|
27
27
|
t2 service create --name "Sui market report" --price 5 --sla 24h # sell deliverable work — no server needed
|
|
28
|
-
t2 browse "market report" # find agent services; hire with t2 job
|
|
28
|
+
t2 browse "market report" # find agent services; hire with t2 job hire --agent … --service …
|
|
29
|
+
t2 job board # the open-jobs board — post with t2 job open, claim with t2 job claim
|
|
29
30
|
t2 job watch --mine # your provider inbox — every job selling to you
|
|
30
31
|
t2 agent sell https://api.you.com/v1 # or list your own x402 endpoint (per-call, live-probed)
|
|
31
32
|
t2 mcp install # wire Claude Desktop / Cursor / Windsurf
|
|
@@ -12348,6 +12348,106 @@ async function getJobSpec(base, hash) {
|
|
|
12348
12348
|
}
|
|
12349
12349
|
return content;
|
|
12350
12350
|
}
|
|
12351
|
+
async function fetchJson(url, init) {
|
|
12352
|
+
const res = await fetch(url, {
|
|
12353
|
+
method: init?.method ?? "GET",
|
|
12354
|
+
headers: init?.body ? { "Content-Type": "application/json" } : void 0,
|
|
12355
|
+
body: init?.body ? JSON.stringify(init.body) : void 0
|
|
12356
|
+
});
|
|
12357
|
+
const json = await res.json().catch(() => ({}));
|
|
12358
|
+
if (!res.ok) {
|
|
12359
|
+
const err = json.error;
|
|
12360
|
+
const msg = typeof err === "string" ? err : err?.message ?? `HTTP ${res.status}`;
|
|
12361
|
+
throw new Error(msg);
|
|
12362
|
+
}
|
|
12363
|
+
return json;
|
|
12364
|
+
}
|
|
12365
|
+
async function listOpenJobs(base, filter = {}) {
|
|
12366
|
+
const params = new URLSearchParams();
|
|
12367
|
+
if (filter.status) params.set("status", filter.status);
|
|
12368
|
+
if (filter.query) params.set("q", filter.query);
|
|
12369
|
+
if (filter.buyer) params.set("buyer", filter.buyer);
|
|
12370
|
+
if (filter.seller) params.set("seller", filter.seller);
|
|
12371
|
+
if (filter.limit) params.set("limit", String(filter.limit));
|
|
12372
|
+
const qs = params.size > 0 ? `?${params.toString()}` : "";
|
|
12373
|
+
const json = await fetchJson(`${base}/open-jobs${qs}`);
|
|
12374
|
+
return json.openJobs ?? [];
|
|
12375
|
+
}
|
|
12376
|
+
async function getOpenJob(base, id) {
|
|
12377
|
+
const json = await fetchJson(
|
|
12378
|
+
`${base}/open-jobs/${encodeURIComponent(id.trim())}`
|
|
12379
|
+
);
|
|
12380
|
+
return json.openJob;
|
|
12381
|
+
}
|
|
12382
|
+
async function signedChallenge(base, signer, action, id) {
|
|
12383
|
+
const address = signer.getAddress();
|
|
12384
|
+
const challenge = await fetchJson(`${base}/agent/challenge`, {
|
|
12385
|
+
method: "POST",
|
|
12386
|
+
body: { address }
|
|
12387
|
+
});
|
|
12388
|
+
const nonce = challenge.nonce;
|
|
12389
|
+
if (!nonce) {
|
|
12390
|
+
throw new Error("Failed to get a challenge nonce.");
|
|
12391
|
+
}
|
|
12392
|
+
const message = new TextEncoder().encode(
|
|
12393
|
+
id ? `t2000-open-${action}:${nonce}:${id}` : `t2000-open-${action}:${nonce}`
|
|
12394
|
+
);
|
|
12395
|
+
const { signature } = await signer.signPersonalMessage(message);
|
|
12396
|
+
return { address, nonce, signature };
|
|
12397
|
+
}
|
|
12398
|
+
async function createOpenJob(base, signer, input) {
|
|
12399
|
+
const auth = await signedChallenge(base, signer, "create");
|
|
12400
|
+
const json = await fetchJson(`${base}/open-jobs`, {
|
|
12401
|
+
method: "POST",
|
|
12402
|
+
body: { ...auth, ...input }
|
|
12403
|
+
});
|
|
12404
|
+
return json.openJob;
|
|
12405
|
+
}
|
|
12406
|
+
async function claimOpenJob(base, signer, id) {
|
|
12407
|
+
const auth = await signedChallenge(base, signer, "claim", id);
|
|
12408
|
+
const json = await fetchJson(
|
|
12409
|
+
`${base}/open-jobs/${encodeURIComponent(id)}/claim`,
|
|
12410
|
+
{ method: "POST", body: auth }
|
|
12411
|
+
);
|
|
12412
|
+
return json.openJob ?? null;
|
|
12413
|
+
}
|
|
12414
|
+
async function unclaimOpenJob(base, signer, id) {
|
|
12415
|
+
const auth = await signedChallenge(base, signer, "unclaim", id);
|
|
12416
|
+
await fetchJson(`${base}/open-jobs/${encodeURIComponent(id)}/unclaim`, {
|
|
12417
|
+
method: "POST",
|
|
12418
|
+
body: auth
|
|
12419
|
+
});
|
|
12420
|
+
}
|
|
12421
|
+
async function cancelOpenJob(base, signer, id) {
|
|
12422
|
+
const auth = await signedChallenge(base, signer, "cancel", id);
|
|
12423
|
+
await fetchJson(`${base}/open-jobs/${encodeURIComponent(id)}/cancel`, {
|
|
12424
|
+
method: "POST",
|
|
12425
|
+
body: auth
|
|
12426
|
+
});
|
|
12427
|
+
}
|
|
12428
|
+
async function fundOpenJob(base, signer, id) {
|
|
12429
|
+
const address = signer.getAddress();
|
|
12430
|
+
const encoded = encodeURIComponent(id.trim());
|
|
12431
|
+
const prep = await fetchJson(`${base}/open-jobs/${encoded}/fund-prepare`, {
|
|
12432
|
+
method: "POST",
|
|
12433
|
+
body: { address }
|
|
12434
|
+
});
|
|
12435
|
+
const nonce = prep.nonce;
|
|
12436
|
+
const txBytes = prep.txBytes;
|
|
12437
|
+
if (!(nonce && txBytes)) {
|
|
12438
|
+
throw new Error("Failed to prepare the funding transaction.");
|
|
12439
|
+
}
|
|
12440
|
+
const { signature } = await signer.signTransaction(fromBase64(txBytes));
|
|
12441
|
+
const json = await fetchJson(`${base}/open-jobs/${encoded}/fund-submit`, {
|
|
12442
|
+
method: "POST",
|
|
12443
|
+
body: { nonce, address, signature }
|
|
12444
|
+
});
|
|
12445
|
+
const digest = json.digest;
|
|
12446
|
+
if (!digest) {
|
|
12447
|
+
throw new Error("The funding transaction did not go through.");
|
|
12448
|
+
}
|
|
12449
|
+
return { digest, jobId: json.jobId ?? null };
|
|
12450
|
+
}
|
|
12351
12451
|
init_coinSelection();
|
|
12352
12452
|
init_cetus_swap();
|
|
12353
12453
|
init_coinSelection();
|
|
@@ -13285,6 +13385,13 @@ export {
|
|
|
13285
13385
|
assertBuyerRequirements,
|
|
13286
13386
|
putJobSpec,
|
|
13287
13387
|
getJobSpec,
|
|
13388
|
+
listOpenJobs,
|
|
13389
|
+
getOpenJob,
|
|
13390
|
+
createOpenJob,
|
|
13391
|
+
claimOpenJob,
|
|
13392
|
+
unclaimOpenJob,
|
|
13393
|
+
cancelOpenJob,
|
|
13394
|
+
fundOpenJob,
|
|
13288
13395
|
SPONSORED_PYTH_DEPENDENT_PROVIDERS,
|
|
13289
13396
|
getSponsoredSwapProviders,
|
|
13290
13397
|
WRITE_APPENDER_REGISTRY,
|
|
@@ -13345,4 +13452,4 @@ export {
|
|
|
13345
13452
|
@scure/bip39/index.js:
|
|
13346
13453
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
13347
13454
|
*/
|
|
13348
|
-
//# sourceMappingURL=chunk-
|
|
13455
|
+
//# sourceMappingURL=chunk-3ZC3KARI.js.map
|