@t2000/cli 10.17.4 → 10.18.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/{chunk-F2KFMF7W.js → chunk-PXQ3GPIL.js} +40 -2
- package/dist/{chunk-F2KFMF7W.js.map → chunk-PXQ3GPIL.js.map} +1 -1
- package/dist/{dist-7RYTY436.js → dist-6ARPIZ47.js} +2 -2
- package/dist/{dist-26EILMT5.js → dist-7E74C4U2.js} +72 -10
- package/dist/{dist-26EILMT5.js.map → dist-7E74C4U2.js.map} +1 -1
- package/dist/index.js +52 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- /package/dist/{dist-7RYTY436.js.map → dist-6ARPIZ47.js.map} +0 -0
|
@@ -211,7 +211,7 @@ import {
|
|
|
211
211
|
verifyReceipt,
|
|
212
212
|
walletExists,
|
|
213
213
|
writeLimitsFile
|
|
214
|
-
} from "./chunk-
|
|
214
|
+
} from "./chunk-PXQ3GPIL.js";
|
|
215
215
|
import "./chunk-634W6JCI.js";
|
|
216
216
|
import "./chunk-3ZUWXUSN.js";
|
|
217
217
|
import "./chunk-QSITA6GU.js";
|
|
@@ -437,4 +437,4 @@ export {
|
|
|
437
437
|
walletExists,
|
|
438
438
|
writeLimitsFile
|
|
439
439
|
};
|
|
440
|
-
//# sourceMappingURL=dist-
|
|
440
|
+
//# sourceMappingURL=dist-6ARPIZ47.js.map
|
|
@@ -145615,6 +145615,44 @@ var LimitEnforcer = class {
|
|
|
145615
145615
|
return dailySpentToday(this.configDir);
|
|
145616
145616
|
}
|
|
145617
145617
|
};
|
|
145618
|
+
var MemoryLimitEnforcer = class extends LimitEnforcer {
|
|
145619
|
+
limitsMem;
|
|
145620
|
+
spend = { date: todayUtc(), usd: 0 };
|
|
145621
|
+
assert(input) {
|
|
145622
|
+
assertLimitConfig({
|
|
145623
|
+
limits: this.limitsMem,
|
|
145624
|
+
spentTodayUsd: this.dailySpentToday(),
|
|
145625
|
+
operation: input.operation,
|
|
145626
|
+
amountUsd: input.amountUsd,
|
|
145627
|
+
force: input.force
|
|
145628
|
+
});
|
|
145629
|
+
}
|
|
145630
|
+
record(amountUsd) {
|
|
145631
|
+
if (!Number.isFinite(amountUsd) || amountUsd <= 0) return;
|
|
145632
|
+
const today = todayUtc();
|
|
145633
|
+
const prior = this.spend.date === today ? this.spend.usd : 0;
|
|
145634
|
+
this.spend = { date: today, usd: prior + amountUsd };
|
|
145635
|
+
}
|
|
145636
|
+
getLimits() {
|
|
145637
|
+
return this.limitsMem;
|
|
145638
|
+
}
|
|
145639
|
+
hasLimits() {
|
|
145640
|
+
const l2 = this.limitsMem;
|
|
145641
|
+
return !!l2 && (l2.perTxUsd !== void 0 || l2.dailyUsd !== void 0);
|
|
145642
|
+
}
|
|
145643
|
+
setLimits(limits) {
|
|
145644
|
+
const merged = { ...this.limitsMem };
|
|
145645
|
+
if (limits.perTxUsd !== void 0) merged.perTxUsd = limits.perTxUsd;
|
|
145646
|
+
if (limits.dailyUsd !== void 0) merged.dailyUsd = limits.dailyUsd;
|
|
145647
|
+
this.limitsMem = merged;
|
|
145648
|
+
}
|
|
145649
|
+
clearLimits() {
|
|
145650
|
+
this.limitsMem = void 0;
|
|
145651
|
+
}
|
|
145652
|
+
dailySpentToday() {
|
|
145653
|
+
return this.spend.date === todayUtc() ? this.spend.usd : 0;
|
|
145654
|
+
}
|
|
145655
|
+
};
|
|
145618
145656
|
var DEFAULT_CONFIG_DIR2 = join$1(homedir(), ".t2000");
|
|
145619
145657
|
var T2000 = class _T2000 extends import_index2.default {
|
|
145620
145658
|
_signer;
|
|
@@ -145637,7 +145675,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
145637
145675
|
this._address = getAddress2(kp);
|
|
145638
145676
|
}
|
|
145639
145677
|
this.client = client;
|
|
145640
|
-
this.limits = new LimitEnforcer(configDir);
|
|
145678
|
+
this.limits = isSignerMode ? new MemoryLimitEnforcer() : new LimitEnforcer(configDir);
|
|
145641
145679
|
}
|
|
145642
145680
|
static async create(options = {}) {
|
|
145643
145681
|
const { keyPath, rpcUrl: rpcUrl2 } = options;
|
|
@@ -147223,12 +147261,13 @@ ${text}`;
|
|
|
147223
147261
|
);
|
|
147224
147262
|
server.tool(
|
|
147225
147263
|
"t2000_agent_sell",
|
|
147226
|
-
"Sell this agent's x402 API
|
|
147264
|
+
"Sell this agent's x402 API as Services on its public Agent ID, so buyers can pay it per call in USDC. Pass the API ORIGIN (https://api.example.com) to list every paid route in its openapi.json, or one route URL to list just that route. Every listed route is LIVE-PROBED server-side first (must answer 402 with a valid Sui payment challenge \u2014 probe failures are returned per-route), then one sponsored (gasless) signature sets the primary route on-chain. The routes appear on t2000.ai and api.t2000.ai/v1/agents/{address} immediately, and buyers find them with t2000_services. Requires an on-chain Agent ID (`t2 agent register`). Set remove: true to clear the listing. Mirrors `t2 agent sell <url>`. This does NOT spend funds.",
|
|
147227
147265
|
{
|
|
147228
|
-
endpoint: external_exports.string().optional().describe("Your x402
|
|
147229
|
-
remove: external_exports.boolean().optional().describe("Remove the listing instead of setting one (default: false)")
|
|
147266
|
+
endpoint: external_exports.string().optional().describe("Your API origin (expands every paid route in its openapi.json) or one x402 route URL (https). Omit only with remove: true."),
|
|
147267
|
+
remove: external_exports.boolean().optional().describe("Remove the listing instead of setting one (default: false)"),
|
|
147268
|
+
primary: external_exports.string().optional().describe('Route path to record as the on-chain primary endpoint, e.g. "/palette" (default: the cheapest paid route)')
|
|
147230
147269
|
},
|
|
147231
|
-
async ({ endpoint, remove }) => {
|
|
147270
|
+
async ({ endpoint, remove, primary }) => {
|
|
147232
147271
|
try {
|
|
147233
147272
|
if (!(remove || endpoint)) {
|
|
147234
147273
|
throw new Error("Provide the x402 endpoint URL (or remove: true to clear the listing).");
|
|
@@ -147239,7 +147278,11 @@ ${text}`;
|
|
|
147239
147278
|
const prepRes = await fetch(`${base}/agent/endpoint/prepare`, {
|
|
147240
147279
|
method: "POST",
|
|
147241
147280
|
headers: { "Content-Type": "application/json" },
|
|
147242
|
-
body: JSON.stringify({
|
|
147281
|
+
body: JSON.stringify({
|
|
147282
|
+
address: address2,
|
|
147283
|
+
endpoint: target,
|
|
147284
|
+
...primary ? { primary } : {}
|
|
147285
|
+
})
|
|
147243
147286
|
});
|
|
147244
147287
|
const prep = await prepRes.json().catch(() => ({}));
|
|
147245
147288
|
if (!prepRes.ok) {
|
|
@@ -147247,7 +147290,17 @@ ${text}`;
|
|
|
147247
147290
|
return {
|
|
147248
147291
|
content: [{
|
|
147249
147292
|
type: "text",
|
|
147250
|
-
text: JSON.stringify({
|
|
147293
|
+
text: JSON.stringify({
|
|
147294
|
+
ok: false,
|
|
147295
|
+
error: msg,
|
|
147296
|
+
probeIssues: prep.probe?.issues ?? [],
|
|
147297
|
+
routes: (prep.routes ?? []).map((r) => ({
|
|
147298
|
+
method: r.method,
|
|
147299
|
+
path: r.path,
|
|
147300
|
+
probeOk: r.probeOk,
|
|
147301
|
+
issues: r.issues ?? []
|
|
147302
|
+
}))
|
|
147303
|
+
})
|
|
147251
147304
|
}],
|
|
147252
147305
|
isError: true
|
|
147253
147306
|
};
|
|
@@ -147273,8 +147326,17 @@ ${text}`;
|
|
|
147273
147326
|
text: JSON.stringify({
|
|
147274
147327
|
ok: true,
|
|
147275
147328
|
listed: !remove,
|
|
147276
|
-
endpoint: remove ? null : target,
|
|
147329
|
+
endpoint: remove ? null : prep.primary?.url ?? target,
|
|
147277
147330
|
pricePerCall: prep.probe?.amount ? `${prep.probe.amount} ${prep.probe.currency ?? "USDC"}` : void 0,
|
|
147331
|
+
origin: prep.origin ?? void 0,
|
|
147332
|
+
routes: remove ? void 0 : (prep.routes ?? []).map((r) => ({
|
|
147333
|
+
method: r.method,
|
|
147334
|
+
path: r.path,
|
|
147335
|
+
url: r.url,
|
|
147336
|
+
priceUsdc: r.priceUsdc,
|
|
147337
|
+
summary: r.summary,
|
|
147338
|
+
primary: r.path === prep.primary?.path || void 0
|
|
147339
|
+
})),
|
|
147278
147340
|
profile: `https://t2000.ai/${address2}`,
|
|
147279
147341
|
digest: sub2.digest
|
|
147280
147342
|
})
|
|
@@ -147444,7 +147506,7 @@ Use t2000_services to see what is actually listed, then hire or pay. t2000 does
|
|
|
147444
147506
|
It can HIRE other agents two ways: Hire \u2014 browse structured fixed-price agent services with t2000_services and fund an on-chain USDC escrow job with t2000_job_hire (a listing via agent+service, or any ASP custom via seller+amount+spec); Open \u2014 post the job to the public board with t2000_job_open (no seller picked; THE BUDGET ESCROWS ON-CHAIN AT POST); the first active ASP claim starts the funded job immediately, and an unclaimed posting refunds fee-free (t2000_job_cancel). Track with t2000_jobs, settle with t2000_job_settle, rate with t2000_job_review \u2014 role-aware: buyers rate the ASP publicly; ASPs rate the buyer (public only if the buyer holds a registered Agent ID; Passport buyers stay private). Escrow protects both sides \u2014 no delivery means an automatic refund path, and an ASP can pass on a funded job with t2000_job_decline (full fee-free refund to the buyer). It can EARN too (as an ASP \u2014 Agent Service Provider): list what THIS agent sells with t2000_service_create (no server or endpoint needed), find open work on the board with t2000_job_board and claim it with t2000_job_claim, watch incoming jobs with t2000_jobs (role: seller), and deliver with t2000_job_deliver \u2014 the escrow pays this wallet on release.
|
|
147445
147507
|
|
|
147446
147508
|
Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice; t2000_job_hire and t2000_job_open lock the agreed price in escrow. For larger or multi-step spends, state the estimated cost first and proceed once the user is happy. Use t2000_balance to check funds. The v4 wallet is payments-only \u2014 there is no savings / lending surface.`;
|
|
147447
|
-
var PKG_VERSION = "10.
|
|
147509
|
+
var PKG_VERSION = "10.18.0";
|
|
147448
147510
|
console.log = (...args) => console.error("[log]", ...args);
|
|
147449
147511
|
console.warn = (...args) => console.error("[warn]", ...args);
|
|
147450
147512
|
async function startMcpServer(opts) {
|
|
@@ -147531,4 +147593,4 @@ mime-types/index.js:
|
|
|
147531
147593
|
@scure/bip39/index.js:
|
|
147532
147594
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
147533
147595
|
*/
|
|
147534
|
-
//# sourceMappingURL=dist-
|
|
147596
|
+
//# sourceMappingURL=dist-7E74C4U2.js.map
|