@t2000/cli 9.12.0 → 9.13.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 +4 -1
- package/dist/{chunk-KHOU3HJU.js → chunk-XPCTSCTS.js} +91 -1
- package/dist/chunk-XPCTSCTS.js.map +1 -0
- package/dist/{dist-PAYZWJCN.js → dist-WU4EKM5J.js} +589 -23
- package/dist/{dist-PAYZWJCN.js.map → dist-WU4EKM5J.js.map} +1 -1
- package/dist/{dist-24ZYDGZH.js → dist-ZIRF2Q6M.js} +12 -2
- package/dist/index.js +11 -54
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/chunk-KHOU3HJU.js.map +0 -1
- /package/dist/{dist-24ZYDGZH.js.map → dist-ZIRF2Q6M.js.map} +0 -0
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
CLOCK_ID,
|
|
13
13
|
COIN_REGISTRY,
|
|
14
14
|
DEFAULT_API_BASE,
|
|
15
|
+
DEFAULT_COMMERCE_API_BASE,
|
|
15
16
|
DEFAULT_GRPC_URL,
|
|
16
17
|
DEFAULT_NETWORK,
|
|
17
18
|
ETH_TYPE,
|
|
@@ -96,6 +97,7 @@ import {
|
|
|
96
97
|
extractTxSender,
|
|
97
98
|
fallbackLabel,
|
|
98
99
|
fetchAllCoins,
|
|
100
|
+
fetchOffering,
|
|
99
101
|
findSwapRoute,
|
|
100
102
|
formatAssetAmount,
|
|
101
103
|
formatSui,
|
|
@@ -107,6 +109,7 @@ import {
|
|
|
107
109
|
getDecimals,
|
|
108
110
|
getDecimalsForCoinType,
|
|
109
111
|
getJob,
|
|
112
|
+
getJobSpec,
|
|
110
113
|
getLimits,
|
|
111
114
|
getSponsoredSwapProviders,
|
|
112
115
|
getSuiClient,
|
|
@@ -119,6 +122,7 @@ import {
|
|
|
119
122
|
jobActionsFor,
|
|
120
123
|
keypairFromPrivateKey,
|
|
121
124
|
listModels,
|
|
125
|
+
listOfferings,
|
|
122
126
|
loadKey,
|
|
123
127
|
looksLikeSuiNs,
|
|
124
128
|
mapMoveAbortCode,
|
|
@@ -135,6 +139,7 @@ import {
|
|
|
135
139
|
preflightPay,
|
|
136
140
|
preflightSend,
|
|
137
141
|
preflightSwap,
|
|
142
|
+
putJobSpec,
|
|
138
143
|
queryBalance,
|
|
139
144
|
queryHistory,
|
|
140
145
|
queryTransaction,
|
|
@@ -166,7 +171,7 @@ import {
|
|
|
166
171
|
verifyReceipt,
|
|
167
172
|
walletExists,
|
|
168
173
|
writeLimitsFile
|
|
169
|
-
} from "./chunk-
|
|
174
|
+
} from "./chunk-XPCTSCTS.js";
|
|
170
175
|
import "./chunk-634W6JCI.js";
|
|
171
176
|
import "./chunk-BHQGGFE6.js";
|
|
172
177
|
import "./chunk-GCC33SG5.js";
|
|
@@ -192,6 +197,7 @@ export {
|
|
|
192
197
|
CLOCK_ID,
|
|
193
198
|
COIN_REGISTRY,
|
|
194
199
|
DEFAULT_API_BASE,
|
|
200
|
+
DEFAULT_COMMERCE_API_BASE,
|
|
195
201
|
DEFAULT_GRPC_URL,
|
|
196
202
|
DEFAULT_NETWORK,
|
|
197
203
|
ETH_TYPE,
|
|
@@ -276,6 +282,7 @@ export {
|
|
|
276
282
|
extractTxSender,
|
|
277
283
|
fallbackLabel,
|
|
278
284
|
fetchAllCoins,
|
|
285
|
+
fetchOffering,
|
|
279
286
|
findSwapRoute,
|
|
280
287
|
formatAssetAmount,
|
|
281
288
|
formatSui,
|
|
@@ -287,6 +294,7 @@ export {
|
|
|
287
294
|
getDecimals,
|
|
288
295
|
getDecimalsForCoinType,
|
|
289
296
|
getJob,
|
|
297
|
+
getJobSpec,
|
|
290
298
|
getLimits,
|
|
291
299
|
getSponsoredSwapProviders,
|
|
292
300
|
getSuiClient,
|
|
@@ -299,6 +307,7 @@ export {
|
|
|
299
307
|
jobActionsFor,
|
|
300
308
|
keypairFromPrivateKey,
|
|
301
309
|
listModels,
|
|
310
|
+
listOfferings,
|
|
302
311
|
loadKey,
|
|
303
312
|
looksLikeSuiNs,
|
|
304
313
|
mapMoveAbortCode,
|
|
@@ -315,6 +324,7 @@ export {
|
|
|
315
324
|
preflightPay,
|
|
316
325
|
preflightSend,
|
|
317
326
|
preflightSwap,
|
|
327
|
+
putJobSpec,
|
|
318
328
|
queryBalance,
|
|
319
329
|
queryHistory,
|
|
320
330
|
queryTransaction,
|
|
@@ -347,4 +357,4 @@ export {
|
|
|
347
357
|
walletExists,
|
|
348
358
|
writeLimitsFile
|
|
349
359
|
};
|
|
350
|
-
//# sourceMappingURL=dist-
|
|
360
|
+
//# sourceMappingURL=dist-ZIRF2Q6M.js.map
|
package/dist/index.js
CHANGED
|
@@ -7,16 +7,19 @@ import {
|
|
|
7
7
|
MAX_JOB_USDC,
|
|
8
8
|
T2000,
|
|
9
9
|
clearLimits,
|
|
10
|
+
fetchOffering,
|
|
10
11
|
formatUsd,
|
|
11
12
|
generateKeypair,
|
|
12
13
|
getAddress,
|
|
13
14
|
getJob,
|
|
15
|
+
getJobSpec,
|
|
14
16
|
getLimits,
|
|
15
17
|
getSuiClient,
|
|
16
18
|
hasLimits,
|
|
17
19
|
jobActionsFor,
|
|
18
20
|
keypairFromPrivateKey,
|
|
19
21
|
listModels,
|
|
22
|
+
putJobSpec,
|
|
20
23
|
saveBech32,
|
|
21
24
|
saveKey,
|
|
22
25
|
setLimits,
|
|
@@ -25,7 +28,7 @@ import {
|
|
|
25
28
|
verifyJobForSeller,
|
|
26
29
|
verifyReceipt,
|
|
27
30
|
walletExists
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-XPCTSCTS.js";
|
|
29
32
|
import "./chunk-634W6JCI.js";
|
|
30
33
|
import "./chunk-BHQGGFE6.js";
|
|
31
34
|
import "./chunk-GCC33SG5.js";
|
|
@@ -22278,7 +22281,7 @@ async function runEstimate(url, opts) {
|
|
|
22278
22281
|
let req = accepts.find((a) => a.scheme === "exact" && a.network?.startsWith("sui:")) ?? accepts[0];
|
|
22279
22282
|
let dialect = "x402";
|
|
22280
22283
|
if (!req) {
|
|
22281
|
-
const { parseMppSuiChallenge } = await import("./dist-
|
|
22284
|
+
const { parseMppSuiChallenge } = await import("./dist-ZIRF2Q6M.js");
|
|
22282
22285
|
const challenge = await parseMppSuiChallenge(response);
|
|
22283
22286
|
if (!challenge) {
|
|
22284
22287
|
throw new Error(
|
|
@@ -23370,7 +23373,7 @@ function registerMcpStart(parent) {
|
|
|
23370
23373
|
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
23374
|
let mod;
|
|
23372
23375
|
try {
|
|
23373
|
-
mod = await import("./dist-
|
|
23376
|
+
mod = await import("./dist-WU4EKM5J.js");
|
|
23374
23377
|
} catch {
|
|
23375
23378
|
console.error("MCP server not installed. Run:\n npm install -g @t2000/mcp");
|
|
23376
23379
|
process.exit(1);
|
|
@@ -24512,11 +24515,10 @@ function registerCheck(program3) {
|
|
|
24512
24515
|
|
|
24513
24516
|
// src/commands/job.ts
|
|
24514
24517
|
var import_picocolors15 = __toESM(require_picocolors(), 1);
|
|
24515
|
-
import { createHash
|
|
24518
|
+
import { createHash } from "crypto";
|
|
24516
24519
|
import { readFile as readFile3 } from "fs/promises";
|
|
24517
24520
|
|
|
24518
24521
|
// src/lib/offerings.ts
|
|
24519
|
-
import { createHash } from "crypto";
|
|
24520
24522
|
async function fetchJson3(url, init) {
|
|
24521
24523
|
const res = await fetch(url, {
|
|
24522
24524
|
method: init?.method ?? "GET",
|
|
@@ -24531,51 +24533,6 @@ async function fetchJson3(url, init) {
|
|
|
24531
24533
|
}
|
|
24532
24534
|
return json;
|
|
24533
24535
|
}
|
|
24534
|
-
async function fetchOffering(base, agent, slug) {
|
|
24535
|
-
const json = await fetchJson3(
|
|
24536
|
-
`${base}/offerings?agent=${encodeURIComponent(agent)}`
|
|
24537
|
-
);
|
|
24538
|
-
const rows = json.offerings ?? [];
|
|
24539
|
-
const match = rows.find((o) => o.slug === slug.trim().toLowerCase());
|
|
24540
|
-
if (!match) {
|
|
24541
|
-
const live = rows.filter((o) => !o.retired).map((o) => o.slug);
|
|
24542
|
-
throw new Error(
|
|
24543
|
-
`Agent ${truncateAddress(agent)} has no offering "${slug}".` + (live.length > 0 ? ` Live offerings: ${live.join(", ")}` : "")
|
|
24544
|
-
);
|
|
24545
|
-
}
|
|
24546
|
-
if (match.retired) {
|
|
24547
|
-
throw new Error(
|
|
24548
|
-
`Offering "${slug}" is retired \u2014 the seller no longer sells it.`
|
|
24549
|
-
);
|
|
24550
|
-
}
|
|
24551
|
-
return match;
|
|
24552
|
-
}
|
|
24553
|
-
async function putJobSpec(base, content) {
|
|
24554
|
-
const json = await fetchJson3(`${base}/job/spec`, {
|
|
24555
|
-
method: "POST",
|
|
24556
|
-
body: { content }
|
|
24557
|
-
});
|
|
24558
|
-
const hash = json.hash;
|
|
24559
|
-
if (!hash) {
|
|
24560
|
-
throw new Error("Failed to store the job spec.");
|
|
24561
|
-
}
|
|
24562
|
-
return hash;
|
|
24563
|
-
}
|
|
24564
|
-
async function getJobSpec(base, hash) {
|
|
24565
|
-
const clean = hash.trim().toLowerCase().replace(/^0x/, "");
|
|
24566
|
-
const json = await fetchJson3(`${base}/job/spec/${clean}`);
|
|
24567
|
-
const content = json.content;
|
|
24568
|
-
if (content === void 0) {
|
|
24569
|
-
throw new Error("No spec stored for this hash.");
|
|
24570
|
-
}
|
|
24571
|
-
const actual = createHash("sha256").update(content, "utf8").digest("hex");
|
|
24572
|
-
if (actual !== clean) {
|
|
24573
|
-
throw new Error(
|
|
24574
|
-
"Spec content does NOT match its hash \u2014 the store returned tampered data. Do not trust it."
|
|
24575
|
-
);
|
|
24576
|
-
}
|
|
24577
|
-
return content;
|
|
24578
|
-
}
|
|
24579
24536
|
|
|
24580
24537
|
// src/commands/job.ts
|
|
24581
24538
|
var DEFAULT_API_BASE5 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
@@ -24600,7 +24557,7 @@ async function resolveCommitment(input) {
|
|
|
24600
24557
|
} catch {
|
|
24601
24558
|
bytes = Buffer.from(input, "utf8");
|
|
24602
24559
|
}
|
|
24603
|
-
return `0x${
|
|
24560
|
+
return `0x${createHash("sha256").update(bytes).digest("hex")}`;
|
|
24604
24561
|
}
|
|
24605
24562
|
function stateColor(state) {
|
|
24606
24563
|
if (state === "released") return import_picocolors15.default.green(state);
|
|
@@ -24927,7 +24884,7 @@ Buying an OFFERING (t2 ACP) \u2014 price + terms come from the listing:
|
|
|
24927
24884
|
stars,
|
|
24928
24885
|
text: opts.text?.trim() || null
|
|
24929
24886
|
};
|
|
24930
|
-
const payloadHash =
|
|
24887
|
+
const payloadHash = createHash("sha256").update(JSON.stringify(payload), "utf8").digest("hex");
|
|
24931
24888
|
const message = new TextEncoder().encode(
|
|
24932
24889
|
`t2000-job-review:${nonce}:${payloadHash}`
|
|
24933
24890
|
);
|
|
@@ -25058,7 +25015,7 @@ Buying an OFFERING (t2 ACP) \u2014 price + terms come from the listing:
|
|
|
25058
25015
|
|
|
25059
25016
|
// src/commands/offering.ts
|
|
25060
25017
|
var import_picocolors16 = __toESM(require_picocolors(), 1);
|
|
25061
|
-
import { createHash as
|
|
25018
|
+
import { createHash as createHash2 } from "crypto";
|
|
25062
25019
|
import { readFile as readFile4 } from "fs/promises";
|
|
25063
25020
|
var DEFAULT_API_BASE6 = process.env.T2000_API_URL ?? "https://api.t2000.ai/v1";
|
|
25064
25021
|
async function signedOfferingAction(opts) {
|
|
@@ -25072,7 +25029,7 @@ async function signedOfferingAction(opts) {
|
|
|
25072
25029
|
if (!nonce) {
|
|
25073
25030
|
throw new Error("Failed to get a challenge nonce.");
|
|
25074
25031
|
}
|
|
25075
|
-
const payloadHash =
|
|
25032
|
+
const payloadHash = createHash2("sha256").update(JSON.stringify(opts.payload), "utf8").digest("hex");
|
|
25076
25033
|
const message = new TextEncoder().encode(
|
|
25077
25034
|
`t2000-agent-offering:${nonce}:${payloadHash}`
|
|
25078
25035
|
);
|