@t2000/cli 5.1.0 → 5.3.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/{dist-3PYU4RZC.js → dist-U65BYMC5.js} +266 -232
- package/dist/dist-U65BYMC5.js.map +1 -0
- package/dist/index.js +244 -334
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/dist-3PYU4RZC.js.map +0 -1
|
@@ -7141,7 +7141,7 @@ var require_compile = __commonJS({
|
|
|
7141
7141
|
const schOrFunc = root.refs[ref];
|
|
7142
7142
|
if (schOrFunc)
|
|
7143
7143
|
return schOrFunc;
|
|
7144
|
-
let _sch =
|
|
7144
|
+
let _sch = resolve2.call(this, root, ref);
|
|
7145
7145
|
if (_sch === void 0) {
|
|
7146
7146
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
7147
7147
|
const { schemaId } = this.opts;
|
|
@@ -7168,7 +7168,7 @@ var require_compile = __commonJS({
|
|
|
7168
7168
|
function sameSchemaEnv(s1, s2) {
|
|
7169
7169
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
7170
7170
|
}
|
|
7171
|
-
function
|
|
7171
|
+
function resolve2(root, ref) {
|
|
7172
7172
|
let sch;
|
|
7173
7173
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
7174
7174
|
ref = sch;
|
|
@@ -7732,7 +7732,7 @@ var require_fast_uri = __commonJS({
|
|
|
7732
7732
|
}
|
|
7733
7733
|
return uri;
|
|
7734
7734
|
}
|
|
7735
|
-
function
|
|
7735
|
+
function resolve2(baseURI, relativeURI, options) {
|
|
7736
7736
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
7737
7737
|
const resolved = resolveComponent(parse5(baseURI, schemelessOptions), parse5(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
7738
7738
|
schemelessOptions.skipEscape = true;
|
|
@@ -7959,7 +7959,7 @@ var require_fast_uri = __commonJS({
|
|
|
7959
7959
|
var fastUri = {
|
|
7960
7960
|
SCHEMES,
|
|
7961
7961
|
normalize: normalize2,
|
|
7962
|
-
resolve:
|
|
7962
|
+
resolve: resolve2,
|
|
7963
7963
|
resolveComponent,
|
|
7964
7964
|
equal,
|
|
7965
7965
|
serialize,
|
|
@@ -16240,8 +16240,8 @@ function promiseWithResolvers() {
|
|
|
16240
16240
|
let resolver;
|
|
16241
16241
|
let rejecter;
|
|
16242
16242
|
return {
|
|
16243
|
-
promise: new Promise((
|
|
16244
|
-
resolver =
|
|
16243
|
+
promise: new Promise((resolve2, reject) => {
|
|
16244
|
+
resolver = resolve2;
|
|
16245
16245
|
rejecter = reject;
|
|
16246
16246
|
}),
|
|
16247
16247
|
resolve: resolver,
|
|
@@ -16378,17 +16378,17 @@ var init_dataloader = __esm({
|
|
|
16378
16378
|
const cachedPromise = cacheMap.get(cacheKey);
|
|
16379
16379
|
if (cachedPromise) {
|
|
16380
16380
|
const cacheHits = batch.cacheHits || (batch.cacheHits = []);
|
|
16381
|
-
return new Promise((
|
|
16381
|
+
return new Promise((resolve2) => {
|
|
16382
16382
|
cacheHits.push(() => {
|
|
16383
|
-
|
|
16383
|
+
resolve2(cachedPromise);
|
|
16384
16384
|
});
|
|
16385
16385
|
});
|
|
16386
16386
|
}
|
|
16387
16387
|
}
|
|
16388
16388
|
batch.keys.push(key);
|
|
16389
|
-
const promise = new Promise((
|
|
16389
|
+
const promise = new Promise((resolve2, reject) => {
|
|
16390
16390
|
batch.callbacks.push({
|
|
16391
|
-
resolve:
|
|
16391
|
+
resolve: resolve2,
|
|
16392
16392
|
reject
|
|
16393
16393
|
});
|
|
16394
16394
|
});
|
|
@@ -17956,12 +17956,12 @@ var init_queue = __esm({
|
|
|
17956
17956
|
SerialQueue = class {
|
|
17957
17957
|
#queue = [];
|
|
17958
17958
|
async runTask(task) {
|
|
17959
|
-
return new Promise((
|
|
17959
|
+
return new Promise((resolve2, reject) => {
|
|
17960
17960
|
this.#queue.push(() => {
|
|
17961
17961
|
task().finally(() => {
|
|
17962
17962
|
this.#queue.shift();
|
|
17963
17963
|
if (this.#queue.length > 0) this.#queue[0]();
|
|
17964
|
-
}).then(
|
|
17964
|
+
}).then(resolve2, reject);
|
|
17965
17965
|
});
|
|
17966
17966
|
if (this.#queue.length === 1) this.#queue[0]();
|
|
17967
17967
|
});
|
|
@@ -17974,18 +17974,18 @@ var init_queue = __esm({
|
|
|
17974
17974
|
this.maxTasks = maxTasks;
|
|
17975
17975
|
}
|
|
17976
17976
|
runTask(task) {
|
|
17977
|
-
return new Promise((
|
|
17977
|
+
return new Promise((resolve2, reject) => {
|
|
17978
17978
|
if (this.activeTasks < this.maxTasks) {
|
|
17979
17979
|
this.activeTasks++;
|
|
17980
17980
|
task().finally(() => {
|
|
17981
17981
|
if (this.#queue.length > 0) this.#queue.shift()();
|
|
17982
17982
|
else this.activeTasks--;
|
|
17983
|
-
}).then(
|
|
17983
|
+
}).then(resolve2, reject);
|
|
17984
17984
|
} else this.#queue.push(() => {
|
|
17985
17985
|
task().finally(() => {
|
|
17986
17986
|
if (this.#queue.length > 0) this.#queue.shift()();
|
|
17987
17987
|
else this.activeTasks--;
|
|
17988
|
-
}).then(
|
|
17988
|
+
}).then(resolve2, reject);
|
|
17989
17989
|
});
|
|
17990
17990
|
});
|
|
17991
17991
|
}
|
|
@@ -18192,11 +18192,11 @@ var init_parallel = __esm({
|
|
|
18192
18192
|
await this.#updateCache(() => this.#waitForLastDigest());
|
|
18193
18193
|
}
|
|
18194
18194
|
async executeTransaction(transaction, include, additionalSignatures = []) {
|
|
18195
|
-
const { promise, resolve:
|
|
18195
|
+
const { promise, resolve: resolve2, reject } = promiseWithResolvers();
|
|
18196
18196
|
const usedObjects = await this.#getUsedObjects(transaction);
|
|
18197
18197
|
const execute = () => {
|
|
18198
18198
|
this.#executeQueue.runTask(() => {
|
|
18199
|
-
return this.#execute(transaction, usedObjects, include, additionalSignatures).then(
|
|
18199
|
+
return this.#execute(transaction, usedObjects, include, additionalSignatures).then(resolve2, reject);
|
|
18200
18200
|
});
|
|
18201
18201
|
};
|
|
18202
18202
|
const conflicts = /* @__PURE__ */ new Set();
|
|
@@ -20417,8 +20417,8 @@ var init_core = __esm({
|
|
|
20417
20417
|
if (scheduleIndex < schedule.length) {
|
|
20418
20418
|
const remaining = t0 + schedule[scheduleIndex] - Date.now();
|
|
20419
20419
|
scheduleIndex++;
|
|
20420
|
-
if (remaining > 0) await Promise.race([new Promise((
|
|
20421
|
-
} else await Promise.race([new Promise((
|
|
20420
|
+
if (remaining > 0) await Promise.race([new Promise((resolve2) => setTimeout(resolve2, remaining)), abortPromise]);
|
|
20421
|
+
} else await Promise.race([new Promise((resolve2) => setTimeout(resolve2, lastInterval)), abortPromise]);
|
|
20422
20422
|
abortSignal.throwIfAborted();
|
|
20423
20423
|
try {
|
|
20424
20424
|
return await this.getTransaction({
|
|
@@ -28067,8 +28067,8 @@ var init_deferred = __esm({
|
|
|
28067
28067
|
*/
|
|
28068
28068
|
constructor(preventUnhandledRejectionWarning = true) {
|
|
28069
28069
|
this._state = DeferredState.PENDING;
|
|
28070
|
-
this._promise = new Promise((
|
|
28071
|
-
this._resolve =
|
|
28070
|
+
this._promise = new Promise((resolve2, reject) => {
|
|
28071
|
+
this._resolve = resolve2;
|
|
28072
28072
|
this._reject = reject;
|
|
28073
28073
|
});
|
|
28074
28074
|
if (preventUnhandledRejectionWarning) {
|
|
@@ -28276,11 +28276,11 @@ var init_unary_call = __esm({
|
|
|
28276
28276
|
"../../node_modules/.pnpm/@protobuf-ts+runtime-rpc@2.11.1/node_modules/@protobuf-ts/runtime-rpc/build/es2015/unary-call.js"() {
|
|
28277
28277
|
__awaiter = function(thisArg, _arguments, P3, generator) {
|
|
28278
28278
|
function adopt(value) {
|
|
28279
|
-
return value instanceof P3 ? value : new P3(function(
|
|
28280
|
-
|
|
28279
|
+
return value instanceof P3 ? value : new P3(function(resolve2) {
|
|
28280
|
+
resolve2(value);
|
|
28281
28281
|
});
|
|
28282
28282
|
}
|
|
28283
|
-
return new (P3 || (P3 = Promise))(function(
|
|
28283
|
+
return new (P3 || (P3 = Promise))(function(resolve2, reject) {
|
|
28284
28284
|
function fulfilled(value) {
|
|
28285
28285
|
try {
|
|
28286
28286
|
step(generator.next(value));
|
|
@@ -28296,7 +28296,7 @@ var init_unary_call = __esm({
|
|
|
28296
28296
|
}
|
|
28297
28297
|
}
|
|
28298
28298
|
function step(result) {
|
|
28299
|
-
result.done ?
|
|
28299
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
28300
28300
|
}
|
|
28301
28301
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28302
28302
|
});
|
|
@@ -28341,11 +28341,11 @@ var init_server_streaming_call = __esm({
|
|
|
28341
28341
|
"../../node_modules/.pnpm/@protobuf-ts+runtime-rpc@2.11.1/node_modules/@protobuf-ts/runtime-rpc/build/es2015/server-streaming-call.js"() {
|
|
28342
28342
|
__awaiter2 = function(thisArg, _arguments, P3, generator) {
|
|
28343
28343
|
function adopt(value) {
|
|
28344
|
-
return value instanceof P3 ? value : new P3(function(
|
|
28345
|
-
|
|
28344
|
+
return value instanceof P3 ? value : new P3(function(resolve2) {
|
|
28345
|
+
resolve2(value);
|
|
28346
28346
|
});
|
|
28347
28347
|
}
|
|
28348
|
-
return new (P3 || (P3 = Promise))(function(
|
|
28348
|
+
return new (P3 || (P3 = Promise))(function(resolve2, reject) {
|
|
28349
28349
|
function fulfilled(value) {
|
|
28350
28350
|
try {
|
|
28351
28351
|
step(generator.next(value));
|
|
@@ -28361,7 +28361,7 @@ var init_server_streaming_call = __esm({
|
|
|
28361
28361
|
}
|
|
28362
28362
|
}
|
|
28363
28363
|
function step(result) {
|
|
28364
|
-
result.done ?
|
|
28364
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
28365
28365
|
}
|
|
28366
28366
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
28367
28367
|
});
|
|
@@ -32936,11 +32936,11 @@ var init_grpc_web_format = __esm({
|
|
|
32936
32936
|
init_goog_grpc_status_code();
|
|
32937
32937
|
__awaiter3 = function(thisArg, _arguments, P3, generator) {
|
|
32938
32938
|
function adopt(value) {
|
|
32939
|
-
return value instanceof P3 ? value : new P3(function(
|
|
32940
|
-
|
|
32939
|
+
return value instanceof P3 ? value : new P3(function(resolve2) {
|
|
32940
|
+
resolve2(value);
|
|
32941
32941
|
});
|
|
32942
32942
|
}
|
|
32943
|
-
return new (P3 || (P3 = Promise))(function(
|
|
32943
|
+
return new (P3 || (P3 = Promise))(function(resolve2, reject) {
|
|
32944
32944
|
function fulfilled(value) {
|
|
32945
32945
|
try {
|
|
32946
32946
|
step(generator.next(value));
|
|
@@ -32956,7 +32956,7 @@ var init_grpc_web_format = __esm({
|
|
|
32956
32956
|
}
|
|
32957
32957
|
}
|
|
32958
32958
|
function step(result) {
|
|
32959
|
-
result.done ?
|
|
32959
|
+
result.done ? resolve2(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
32960
32960
|
}
|
|
32961
32961
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32962
32962
|
});
|
|
@@ -45689,10 +45689,10 @@ var init_CanceledError = __esm({
|
|
|
45689
45689
|
CanceledError_default = CanceledError;
|
|
45690
45690
|
}
|
|
45691
45691
|
});
|
|
45692
|
-
function settle(
|
|
45692
|
+
function settle(resolve2, reject, response) {
|
|
45693
45693
|
const validateStatus2 = response.config.validateStatus;
|
|
45694
45694
|
if (!response.status || !validateStatus2 || validateStatus2(response.status)) {
|
|
45695
|
-
|
|
45695
|
+
resolve2(response);
|
|
45696
45696
|
} else {
|
|
45697
45697
|
reject(
|
|
45698
45698
|
new AxiosError_default(
|
|
@@ -47885,7 +47885,7 @@ var init_http = __esm({
|
|
|
47885
47885
|
http2Sessions = new Http2Sessions();
|
|
47886
47886
|
isHttpAdapterSupported = typeof process !== "undefined" && utils_default.kindOf(process) === "process";
|
|
47887
47887
|
wrapAsync = (asyncExecutor) => {
|
|
47888
|
-
return new Promise((
|
|
47888
|
+
return new Promise((resolve2, reject) => {
|
|
47889
47889
|
let onDone;
|
|
47890
47890
|
let isDone;
|
|
47891
47891
|
const done = (value, isRejected) => {
|
|
@@ -47895,7 +47895,7 @@ var init_http = __esm({
|
|
|
47895
47895
|
};
|
|
47896
47896
|
const _resolve = (value) => {
|
|
47897
47897
|
done(value);
|
|
47898
|
-
|
|
47898
|
+
resolve2(value);
|
|
47899
47899
|
};
|
|
47900
47900
|
const _reject = (reason) => {
|
|
47901
47901
|
done(reason, true);
|
|
@@ -47942,7 +47942,7 @@ var init_http = __esm({
|
|
|
47942
47942
|
}
|
|
47943
47943
|
};
|
|
47944
47944
|
http_default = isHttpAdapterSupported && function httpAdapter(config3) {
|
|
47945
|
-
return wrapAsync(async function dispatchHttpRequest(
|
|
47945
|
+
return wrapAsync(async function dispatchHttpRequest(resolve2, reject, onDone) {
|
|
47946
47946
|
const own2 = (key) => utils_default.hasOwnProp(config3, key) ? config3[key] : void 0;
|
|
47947
47947
|
let data = own2("data");
|
|
47948
47948
|
let lookup = own2("lookup");
|
|
@@ -48039,7 +48039,7 @@ var init_http = __esm({
|
|
|
48039
48039
|
}
|
|
48040
48040
|
let convertedData;
|
|
48041
48041
|
if (method !== "GET") {
|
|
48042
|
-
return settle(
|
|
48042
|
+
return settle(resolve2, reject, {
|
|
48043
48043
|
status: 405,
|
|
48044
48044
|
statusText: "method not allowed",
|
|
48045
48045
|
headers: {},
|
|
@@ -48061,7 +48061,7 @@ var init_http = __esm({
|
|
|
48061
48061
|
} else if (responseType === "stream") {
|
|
48062
48062
|
convertedData = stream3.Readable.from(convertedData);
|
|
48063
48063
|
}
|
|
48064
|
-
return settle(
|
|
48064
|
+
return settle(resolve2, reject, {
|
|
48065
48065
|
data: convertedData,
|
|
48066
48066
|
status: 200,
|
|
48067
48067
|
statusText: "OK",
|
|
@@ -48346,7 +48346,7 @@ var init_http = __esm({
|
|
|
48346
48346
|
});
|
|
48347
48347
|
}
|
|
48348
48348
|
response.data = responseStream;
|
|
48349
|
-
settle(
|
|
48349
|
+
settle(resolve2, reject, response);
|
|
48350
48350
|
} else {
|
|
48351
48351
|
const responseBuffer = [];
|
|
48352
48352
|
let totalResponseBytes = 0;
|
|
@@ -48396,7 +48396,7 @@ var init_http = __esm({
|
|
|
48396
48396
|
} catch (err) {
|
|
48397
48397
|
return reject(AxiosError_default.from(err, null, config3, response.request, response));
|
|
48398
48398
|
}
|
|
48399
|
-
settle(
|
|
48399
|
+
settle(resolve2, reject, response);
|
|
48400
48400
|
});
|
|
48401
48401
|
}
|
|
48402
48402
|
abortEmitter.once("abort", (err) => {
|
|
@@ -48761,7 +48761,7 @@ var init_xhr = __esm({
|
|
|
48761
48761
|
init_resolveConfig();
|
|
48762
48762
|
isXHRAdapterSupported = typeof XMLHttpRequest !== "undefined";
|
|
48763
48763
|
xhr_default = isXHRAdapterSupported && function(config3) {
|
|
48764
|
-
return new Promise(function dispatchXhrRequest(
|
|
48764
|
+
return new Promise(function dispatchXhrRequest(resolve2, reject) {
|
|
48765
48765
|
const _config = resolveConfig_default(config3);
|
|
48766
48766
|
let requestData = _config.data;
|
|
48767
48767
|
const requestHeaders = AxiosHeaders_default.from(_config.headers).normalize();
|
|
@@ -48796,7 +48796,7 @@ var init_xhr = __esm({
|
|
|
48796
48796
|
};
|
|
48797
48797
|
settle(
|
|
48798
48798
|
function _resolve(value) {
|
|
48799
|
-
|
|
48799
|
+
resolve2(value);
|
|
48800
48800
|
done();
|
|
48801
48801
|
},
|
|
48802
48802
|
function _reject(err) {
|
|
@@ -49237,8 +49237,8 @@ var init_fetch = __esm({
|
|
|
49237
49237
|
config3
|
|
49238
49238
|
);
|
|
49239
49239
|
!isStreamResponse && unsubscribe && unsubscribe();
|
|
49240
|
-
return await new Promise((
|
|
49241
|
-
settle(
|
|
49240
|
+
return await new Promise((resolve2, reject) => {
|
|
49241
|
+
settle(resolve2, reject, {
|
|
49242
49242
|
data: responseData,
|
|
49243
49243
|
headers: AxiosHeaders_default.from(response.headers),
|
|
49244
49244
|
status: response.status,
|
|
@@ -49708,8 +49708,8 @@ var init_CancelToken = __esm({
|
|
|
49708
49708
|
throw new TypeError("executor must be a function.");
|
|
49709
49709
|
}
|
|
49710
49710
|
let resolvePromise;
|
|
49711
|
-
this.promise = new Promise(function promiseExecutor(
|
|
49712
|
-
resolvePromise =
|
|
49711
|
+
this.promise = new Promise(function promiseExecutor(resolve2) {
|
|
49712
|
+
resolvePromise = resolve2;
|
|
49713
49713
|
});
|
|
49714
49714
|
const token = this;
|
|
49715
49715
|
this.promise.then((cancel) => {
|
|
@@ -49722,9 +49722,9 @@ var init_CancelToken = __esm({
|
|
|
49722
49722
|
});
|
|
49723
49723
|
this.promise.then = (onfulfilled) => {
|
|
49724
49724
|
let _resolve;
|
|
49725
|
-
const promise = new Promise((
|
|
49726
|
-
token.subscribe(
|
|
49727
|
-
_resolve =
|
|
49725
|
+
const promise = new Promise((resolve2) => {
|
|
49726
|
+
token.subscribe(resolve2);
|
|
49727
|
+
_resolve = resolve2;
|
|
49728
49728
|
}).then(onfulfilled);
|
|
49729
49729
|
promise.cancel = function reject() {
|
|
49730
49730
|
token.unsubscribe(_resolve);
|
|
@@ -50596,7 +50596,7 @@ var init_hermes_client = __esm({
|
|
|
50596
50596
|
return schema.parse(data);
|
|
50597
50597
|
} catch (error2) {
|
|
50598
50598
|
if (retries > 0 && !(error2 instanceof Error && error2.name === "AbortError")) {
|
|
50599
|
-
await new Promise((
|
|
50599
|
+
await new Promise((resolve2) => setTimeout(resolve2, backoff));
|
|
50600
50600
|
return this.httpRequest(url2, schema, options, retries - 1, backoff * 2);
|
|
50601
50601
|
}
|
|
50602
50602
|
throw error2;
|
|
@@ -72140,7 +72140,7 @@ var Protocol = class {
|
|
|
72140
72140
|
return;
|
|
72141
72141
|
}
|
|
72142
72142
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
72143
|
-
await new Promise((
|
|
72143
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
72144
72144
|
options?.signal?.throwIfAborted();
|
|
72145
72145
|
}
|
|
72146
72146
|
} catch (error2) {
|
|
@@ -72157,7 +72157,7 @@ var Protocol = class {
|
|
|
72157
72157
|
*/
|
|
72158
72158
|
request(request, resultSchema, options) {
|
|
72159
72159
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
72160
|
-
return new Promise((
|
|
72160
|
+
return new Promise((resolve2, reject) => {
|
|
72161
72161
|
const earlyReject = (error2) => {
|
|
72162
72162
|
reject(error2);
|
|
72163
72163
|
};
|
|
@@ -72235,7 +72235,7 @@ var Protocol = class {
|
|
|
72235
72235
|
if (!parseResult.success) {
|
|
72236
72236
|
reject(parseResult.error);
|
|
72237
72237
|
} else {
|
|
72238
|
-
|
|
72238
|
+
resolve2(parseResult.data);
|
|
72239
72239
|
}
|
|
72240
72240
|
} catch (error2) {
|
|
72241
72241
|
reject(error2);
|
|
@@ -72496,12 +72496,12 @@ var Protocol = class {
|
|
|
72496
72496
|
}
|
|
72497
72497
|
} catch {
|
|
72498
72498
|
}
|
|
72499
|
-
return new Promise((
|
|
72499
|
+
return new Promise((resolve2, reject) => {
|
|
72500
72500
|
if (signal.aborted) {
|
|
72501
72501
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
72502
72502
|
return;
|
|
72503
72503
|
}
|
|
72504
|
-
const timeoutId = setTimeout(
|
|
72504
|
+
const timeoutId = setTimeout(resolve2, interval);
|
|
72505
72505
|
signal.addEventListener("abort", () => {
|
|
72506
72506
|
clearTimeout(timeoutId);
|
|
72507
72507
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -73573,7 +73573,7 @@ var McpServer = class {
|
|
|
73573
73573
|
let task = createTaskResult.task;
|
|
73574
73574
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
73575
73575
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
73576
|
-
await new Promise((
|
|
73576
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
73577
73577
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
73578
73578
|
if (!updatedTask) {
|
|
73579
73579
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -74215,12 +74215,12 @@ var StdioServerTransport = class {
|
|
|
74215
74215
|
this.onclose?.();
|
|
74216
74216
|
}
|
|
74217
74217
|
send(message) {
|
|
74218
|
-
return new Promise((
|
|
74218
|
+
return new Promise((resolve2) => {
|
|
74219
74219
|
const json = serializeMessage(message);
|
|
74220
74220
|
if (this._stdout.write(json)) {
|
|
74221
|
-
|
|
74221
|
+
resolve2();
|
|
74222
74222
|
} else {
|
|
74223
|
-
this._stdout.once("drain",
|
|
74223
|
+
this._stdout.once("drain", resolve2);
|
|
74224
74224
|
}
|
|
74225
74225
|
});
|
|
74226
74226
|
}
|
|
@@ -80051,164 +80051,194 @@ async function resolveSuinsViaRpc(rawName, ctx = {}) {
|
|
|
80051
80051
|
return body.result ?? null;
|
|
80052
80052
|
}
|
|
80053
80053
|
init_errors3();
|
|
80054
|
-
var
|
|
80055
|
-
|
|
80056
|
-
|
|
80057
|
-
|
|
80058
|
-
|
|
80059
|
-
|
|
80060
|
-
}
|
|
80061
|
-
|
|
80062
|
-
|
|
80063
|
-
|
|
80064
|
-
|
|
80065
|
-
|
|
80066
|
-
|
|
80067
|
-
|
|
80068
|
-
|
|
80069
|
-
|
|
80070
|
-
|
|
80054
|
+
var DEFAULT_CONFIG_DIR = join$1(homedir(), ".t2000");
|
|
80055
|
+
function resolveConfigPath(configDir) {
|
|
80056
|
+
return join$1(configDir ?? DEFAULT_CONFIG_DIR, "config.json");
|
|
80057
|
+
}
|
|
80058
|
+
function todayUtc() {
|
|
80059
|
+
return (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
80060
|
+
}
|
|
80061
|
+
function readLimitsFile(configDir) {
|
|
80062
|
+
const path = resolveConfigPath(configDir);
|
|
80063
|
+
try {
|
|
80064
|
+
return sanitize(JSON.parse(readFileSync(path, "utf-8")));
|
|
80065
|
+
} catch {
|
|
80066
|
+
return {};
|
|
80067
|
+
}
|
|
80068
|
+
}
|
|
80069
|
+
function writeLimitsFile(file, configDir) {
|
|
80070
|
+
const path = resolveConfigPath(configDir);
|
|
80071
|
+
let existing = {};
|
|
80072
|
+
try {
|
|
80073
|
+
existing = JSON.parse(readFileSync(path, "utf-8"));
|
|
80074
|
+
} catch {
|
|
80075
|
+
existing = {};
|
|
80076
|
+
}
|
|
80077
|
+
for (const dead of ["maxPerTx", "maxDailySend", "dailyUsed", "dailyResetDate", "locked"]) {
|
|
80078
|
+
delete existing[dead];
|
|
80079
|
+
}
|
|
80080
|
+
const merged = { ...existing };
|
|
80081
|
+
if (file.limits && (file.limits.perTxUsd !== void 0 || file.limits.dailyUsd !== void 0)) {
|
|
80082
|
+
merged.limits = file.limits;
|
|
80083
|
+
} else {
|
|
80084
|
+
delete merged.limits;
|
|
80085
|
+
}
|
|
80086
|
+
if (file.dailySpend) merged.dailySpend = file.dailySpend;
|
|
80087
|
+
else delete merged.dailySpend;
|
|
80088
|
+
const dir = dirname(path);
|
|
80089
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
80090
|
+
writeFileSync(path, JSON.stringify(merged, null, 2) + "\n", { mode: 384 });
|
|
80091
|
+
return path;
|
|
80092
|
+
}
|
|
80093
|
+
function getLimits(configDir) {
|
|
80094
|
+
return readLimitsFile(configDir).limits;
|
|
80095
|
+
}
|
|
80096
|
+
function hasLimits(configDir) {
|
|
80097
|
+
const l2 = readLimitsFile(configDir).limits;
|
|
80098
|
+
return !!l2 && (l2.perTxUsd !== void 0 || l2.dailyUsd !== void 0);
|
|
80099
|
+
}
|
|
80100
|
+
function setLimits(limits, configDir) {
|
|
80101
|
+
const file = readLimitsFile(configDir);
|
|
80102
|
+
const merged = { ...file.limits };
|
|
80103
|
+
if (limits.perTxUsd !== void 0) merged.perTxUsd = limits.perTxUsd;
|
|
80104
|
+
if (limits.dailyUsd !== void 0) merged.dailyUsd = limits.dailyUsd;
|
|
80105
|
+
return writeLimitsFile({ ...file, limits: merged }, configDir);
|
|
80106
|
+
}
|
|
80107
|
+
function clearLimits(configDir) {
|
|
80108
|
+
const file = readLimitsFile(configDir);
|
|
80109
|
+
return writeLimitsFile({ ...file, limits: void 0 }, configDir);
|
|
80110
|
+
}
|
|
80111
|
+
function dailySpentToday(configDir) {
|
|
80112
|
+
const { dailySpend } = readLimitsFile(configDir);
|
|
80113
|
+
if (!dailySpend || dailySpend.date !== todayUtc()) return 0;
|
|
80114
|
+
return dailySpend.usd;
|
|
80115
|
+
}
|
|
80116
|
+
function recordDailySpend(usd, configDir) {
|
|
80117
|
+
if (!Number.isFinite(usd) || usd <= 0) return;
|
|
80118
|
+
const file = readLimitsFile(configDir);
|
|
80119
|
+
const today = todayUtc();
|
|
80120
|
+
const prior = file.dailySpend && file.dailySpend.date === today ? file.dailySpend.usd : 0;
|
|
80121
|
+
writeLimitsFile({ ...file, dailySpend: { date: today, usd: prior + usd } }, configDir);
|
|
80122
|
+
}
|
|
80123
|
+
function sanitize(raw) {
|
|
80124
|
+
if (typeof raw !== "object" || raw === null) return {};
|
|
80125
|
+
const r = raw;
|
|
80126
|
+
const out = {};
|
|
80127
|
+
if (typeof r.limits === "object" && r.limits !== null) {
|
|
80128
|
+
const l2 = r.limits;
|
|
80129
|
+
const limits = {};
|
|
80130
|
+
if (typeof l2.perTxUsd === "number" && l2.perTxUsd > 0) limits.perTxUsd = l2.perTxUsd;
|
|
80131
|
+
if (typeof l2.dailyUsd === "number" && l2.dailyUsd > 0) limits.dailyUsd = l2.dailyUsd;
|
|
80132
|
+
else if (typeof l2.dailySendUsd === "number" && l2.dailySendUsd > 0) limits.dailyUsd = l2.dailySendUsd;
|
|
80133
|
+
if (limits.perTxUsd !== void 0 || limits.dailyUsd !== void 0) out.limits = limits;
|
|
80134
|
+
}
|
|
80135
|
+
if (typeof r.dailySpend === "object" && r.dailySpend !== null) {
|
|
80136
|
+
const d = r.dailySpend;
|
|
80137
|
+
if (typeof d.date === "string" && typeof d.usd === "number" && d.usd >= 0) {
|
|
80138
|
+
out.dailySpend = { date: d.date, usd: d.usd };
|
|
80139
|
+
}
|
|
80140
|
+
}
|
|
80141
|
+
return out;
|
|
80142
|
+
}
|
|
80143
|
+
var LimitExceededError = class extends Error {
|
|
80144
|
+
code = "LIMIT_EXCEEDED";
|
|
80145
|
+
operation;
|
|
80146
|
+
limitKind;
|
|
80147
|
+
limit;
|
|
80148
|
+
attempted;
|
|
80149
|
+
constructor(params) {
|
|
80150
|
+
const label = params.limitKind === "perTxUsd" ? "per-transaction limit" : "daily spend limit";
|
|
80151
|
+
super(
|
|
80152
|
+
`Exceeds ${label} ($${params.limit}). Attempted $${params.attempted.toFixed(2)}. Use --force / force:true to override.`
|
|
80153
|
+
);
|
|
80154
|
+
this.name = "LimitExceededError";
|
|
80155
|
+
this.operation = params.operation;
|
|
80156
|
+
this.limitKind = params.limitKind;
|
|
80157
|
+
this.limit = params.limit;
|
|
80158
|
+
this.attempted = params.attempted;
|
|
80071
80159
|
}
|
|
80072
80160
|
toJSON() {
|
|
80073
80161
|
return {
|
|
80074
|
-
error:
|
|
80162
|
+
error: this.code,
|
|
80075
80163
|
message: this.message,
|
|
80076
|
-
|
|
80077
|
-
|
|
80164
|
+
operation: this.operation,
|
|
80165
|
+
limitKind: this.limitKind,
|
|
80166
|
+
limit: this.limit,
|
|
80167
|
+
attempted: this.attempted
|
|
80078
80168
|
};
|
|
80079
80169
|
}
|
|
80080
80170
|
};
|
|
80081
|
-
function
|
|
80082
|
-
|
|
80083
|
-
|
|
80084
|
-
|
|
80085
|
-
|
|
80086
|
-
|
|
80087
|
-
|
|
80088
|
-
|
|
80089
|
-
}
|
|
80090
|
-
|
|
80091
|
-
|
|
80092
|
-
|
|
80093
|
-
|
|
80094
|
-
|
|
80095
|
-
|
|
80096
|
-
|
|
80097
|
-
|
|
80098
|
-
load() {
|
|
80099
|
-
if (!this.configPath) return;
|
|
80100
|
-
try {
|
|
80101
|
-
const raw = JSON.parse(readFileSync(this.configPath, "utf-8"));
|
|
80102
|
-
this.config = {
|
|
80103
|
-
...DEFAULT_SAFEGUARD_CONFIG,
|
|
80104
|
-
locked: raw.locked ?? false,
|
|
80105
|
-
maxPerTx: raw.maxPerTx ?? 0,
|
|
80106
|
-
maxDailySend: raw.maxDailySend ?? 0,
|
|
80107
|
-
dailyUsed: raw.dailyUsed ?? 0,
|
|
80108
|
-
dailyResetDate: raw.dailyResetDate ?? ""
|
|
80109
|
-
};
|
|
80110
|
-
} catch {
|
|
80111
|
-
this.config = { ...DEFAULT_SAFEGUARD_CONFIG };
|
|
80112
|
-
}
|
|
80113
|
-
}
|
|
80114
|
-
assertNotLocked() {
|
|
80115
|
-
this.load();
|
|
80116
|
-
if (this.config.locked) {
|
|
80117
|
-
throw new SafeguardError("locked", {});
|
|
80118
|
-
}
|
|
80119
|
-
}
|
|
80120
|
-
check(metadata) {
|
|
80121
|
-
this.load();
|
|
80122
|
-
if (this.config.locked) {
|
|
80123
|
-
throw new SafeguardError("locked", {});
|
|
80124
|
-
}
|
|
80125
|
-
const amount = metadata.amount ?? 0;
|
|
80126
|
-
if (this.config.maxPerTx > 0 && amount > this.config.maxPerTx) {
|
|
80127
|
-
throw new SafeguardError("maxPerTx", {
|
|
80128
|
-
attempted: amount,
|
|
80129
|
-
limit: this.config.maxPerTx
|
|
80130
|
-
});
|
|
80131
|
-
}
|
|
80132
|
-
this.resetDailyIfNewDay();
|
|
80133
|
-
if (this.config.maxDailySend > 0 && this.config.dailyUsed + amount > this.config.maxDailySend) {
|
|
80134
|
-
throw new SafeguardError("maxDailySend", {
|
|
80135
|
-
attempted: amount,
|
|
80136
|
-
limit: this.config.maxDailySend,
|
|
80137
|
-
current: this.config.dailyUsed
|
|
80138
|
-
});
|
|
80139
|
-
}
|
|
80171
|
+
function approxUsdValue(asset, amount) {
|
|
80172
|
+
const symbol = asset.toUpperCase();
|
|
80173
|
+
if (symbol === "USDC" || symbol === "USDSUI") return amount;
|
|
80174
|
+
return null;
|
|
80175
|
+
}
|
|
80176
|
+
function assertLimitConfig(input) {
|
|
80177
|
+
if (input.force) return;
|
|
80178
|
+
if (!Number.isFinite(input.amountUsd) || input.amountUsd <= 0) return;
|
|
80179
|
+
const { limits } = input;
|
|
80180
|
+
if (!limits) return;
|
|
80181
|
+
if (limits.perTxUsd !== void 0 && input.amountUsd > limits.perTxUsd) {
|
|
80182
|
+
throw new LimitExceededError({
|
|
80183
|
+
operation: input.operation,
|
|
80184
|
+
limitKind: "perTxUsd",
|
|
80185
|
+
limit: limits.perTxUsd,
|
|
80186
|
+
attempted: input.amountUsd
|
|
80187
|
+
});
|
|
80140
80188
|
}
|
|
80141
|
-
|
|
80142
|
-
|
|
80143
|
-
|
|
80144
|
-
|
|
80189
|
+
if (limits.dailyUsd !== void 0 && input.spentTodayUsd + input.amountUsd > limits.dailyUsd) {
|
|
80190
|
+
throw new LimitExceededError({
|
|
80191
|
+
operation: input.operation,
|
|
80192
|
+
limitKind: "dailyUsd",
|
|
80193
|
+
// The cap is total/day; report the cap (attempted is THIS write's USD).
|
|
80194
|
+
limit: limits.dailyUsd,
|
|
80195
|
+
attempted: input.spentTodayUsd + input.amountUsd
|
|
80196
|
+
});
|
|
80145
80197
|
}
|
|
80146
|
-
|
|
80147
|
-
|
|
80148
|
-
|
|
80198
|
+
}
|
|
80199
|
+
var LimitEnforcer = class {
|
|
80200
|
+
constructor(configDir) {
|
|
80201
|
+
this.configDir = configDir;
|
|
80202
|
+
}
|
|
80203
|
+
/** Throws `LimitExceededError` when the write exceeds an opted-in cap. */
|
|
80204
|
+
assert(input) {
|
|
80205
|
+
assertLimitConfig({
|
|
80206
|
+
limits: getLimits(this.configDir),
|
|
80207
|
+
spentTodayUsd: dailySpentToday(this.configDir),
|
|
80208
|
+
operation: input.operation,
|
|
80209
|
+
amountUsd: input.amountUsd,
|
|
80210
|
+
force: input.force
|
|
80211
|
+
});
|
|
80149
80212
|
}
|
|
80150
|
-
|
|
80151
|
-
|
|
80152
|
-
this.
|
|
80213
|
+
/** Add a settled write's USD value to today's cumulative total. */
|
|
80214
|
+
record(amountUsd) {
|
|
80215
|
+
recordDailySpend(amountUsd, this.configDir);
|
|
80153
80216
|
}
|
|
80154
|
-
|
|
80155
|
-
|
|
80156
|
-
this.config.locked = value;
|
|
80157
|
-
} else if (key === "maxPerTx" && typeof value === "number") {
|
|
80158
|
-
this.config.maxPerTx = value;
|
|
80159
|
-
} else if (key === "maxDailySend" && typeof value === "number") {
|
|
80160
|
-
this.config.maxDailySend = value;
|
|
80161
|
-
}
|
|
80162
|
-
this.save();
|
|
80217
|
+
getLimits() {
|
|
80218
|
+
return getLimits(this.configDir);
|
|
80163
80219
|
}
|
|
80164
|
-
|
|
80165
|
-
this.
|
|
80166
|
-
this.resetDailyIfNewDay();
|
|
80167
|
-
return { ...this.config };
|
|
80220
|
+
hasLimits() {
|
|
80221
|
+
return hasLimits(this.configDir);
|
|
80168
80222
|
}
|
|
80169
|
-
|
|
80170
|
-
|
|
80223
|
+
setLimits(limits) {
|
|
80224
|
+
setLimits(limits, this.configDir);
|
|
80171
80225
|
}
|
|
80172
|
-
|
|
80173
|
-
|
|
80174
|
-
if (this.config.dailyResetDate !== today) {
|
|
80175
|
-
this.config.dailyUsed = 0;
|
|
80176
|
-
this.config.dailyResetDate = today;
|
|
80177
|
-
this.save();
|
|
80178
|
-
}
|
|
80226
|
+
clearLimits() {
|
|
80227
|
+
clearLimits(this.configDir);
|
|
80179
80228
|
}
|
|
80180
|
-
|
|
80181
|
-
|
|
80182
|
-
try {
|
|
80183
|
-
let existing = {};
|
|
80184
|
-
try {
|
|
80185
|
-
existing = JSON.parse(readFileSync(this.configPath, "utf-8"));
|
|
80186
|
-
} catch {
|
|
80187
|
-
}
|
|
80188
|
-
const merged = {
|
|
80189
|
-
...existing,
|
|
80190
|
-
locked: this.config.locked,
|
|
80191
|
-
maxPerTx: this.config.maxPerTx,
|
|
80192
|
-
maxDailySend: this.config.maxDailySend,
|
|
80193
|
-
dailyUsed: this.config.dailyUsed,
|
|
80194
|
-
dailyResetDate: this.config.dailyResetDate
|
|
80195
|
-
};
|
|
80196
|
-
const dir = this.configPath.replace(/[/\\][^/\\]+$/, "");
|
|
80197
|
-
if (!existsSync(dir)) {
|
|
80198
|
-
mkdirSync(dir, { recursive: true });
|
|
80199
|
-
}
|
|
80200
|
-
writeFileSync(this.configPath, JSON.stringify(merged, null, 2) + "\n");
|
|
80201
|
-
} catch {
|
|
80202
|
-
}
|
|
80229
|
+
dailySpentToday() {
|
|
80230
|
+
return dailySpentToday(this.configDir);
|
|
80203
80231
|
}
|
|
80204
80232
|
};
|
|
80205
|
-
var
|
|
80233
|
+
var DEFAULT_CONFIG_DIR2 = join$1(homedir(), ".t2000");
|
|
80206
80234
|
var T2000 = class _T2000 extends import_index2.default {
|
|
80207
80235
|
_signer;
|
|
80208
80236
|
_keypair;
|
|
80209
80237
|
client;
|
|
80210
80238
|
_address;
|
|
80211
|
-
|
|
80239
|
+
/** Unified spending-limit gate (per-tx + cumulative daily, USD). Shared by
|
|
80240
|
+
* CLI + MCP + programmatic writes — one gate, no bypass (R-0 Finding 1). */
|
|
80241
|
+
limits;
|
|
80212
80242
|
constructor(keypairOrSigner, client, configDir, isSignerMode) {
|
|
80213
80243
|
super();
|
|
80214
80244
|
if (isSignerMode) {
|
|
@@ -80222,8 +80252,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80222
80252
|
this._address = getAddress(kp);
|
|
80223
80253
|
}
|
|
80224
80254
|
this.client = client;
|
|
80225
|
-
this.
|
|
80226
|
-
this.enforcer.load();
|
|
80255
|
+
this.limits = new LimitEnforcer(configDir);
|
|
80227
80256
|
}
|
|
80228
80257
|
static async create(options = {}) {
|
|
80229
80258
|
const { keyPath, rpcUrl } = options;
|
|
@@ -80236,7 +80265,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80236
80265
|
);
|
|
80237
80266
|
}
|
|
80238
80267
|
const keypair = await loadKey(void 0, keyPath);
|
|
80239
|
-
return new _T2000(keypair, client,
|
|
80268
|
+
return new _T2000(keypair, client, DEFAULT_CONFIG_DIR2);
|
|
80240
80269
|
}
|
|
80241
80270
|
static fromPrivateKey(privateKey, options = {}) {
|
|
80242
80271
|
const keypair = keypairFromPrivateKey(privateKey);
|
|
@@ -80247,7 +80276,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80247
80276
|
const keypair = generateKeypair();
|
|
80248
80277
|
await saveKey(keypair, void 0, options.keyPath);
|
|
80249
80278
|
const client = getSuiClient();
|
|
80250
|
-
const agent = new _T2000(keypair, client,
|
|
80279
|
+
const agent = new _T2000(keypair, client, DEFAULT_CONFIG_DIR2);
|
|
80251
80280
|
const address = agent.address();
|
|
80252
80281
|
return { agent, address };
|
|
80253
80282
|
}
|
|
@@ -80269,11 +80298,10 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80269
80298
|
}
|
|
80270
80299
|
// -- MPP Payments --
|
|
80271
80300
|
async pay(options) {
|
|
80272
|
-
this.
|
|
80273
|
-
this.enforcer.check({ operation: "pay", amount: options.maxPrice ?? 1 });
|
|
80301
|
+
this.limits.assert({ operation: "pay", amountUsd: options.maxPrice ?? 0, force: options.force });
|
|
80274
80302
|
const result = await payWithMpp({ signer: this._signer, client: this.client, options });
|
|
80275
80303
|
if (result.paid) {
|
|
80276
|
-
this.
|
|
80304
|
+
this.limits.record(result.cost ?? options.maxPrice ?? 0);
|
|
80277
80305
|
}
|
|
80278
80306
|
return result;
|
|
80279
80307
|
}
|
|
@@ -80287,7 +80315,11 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80287
80315
|
// and the S.323 build-tracker entry.
|
|
80288
80316
|
// -- Swap --
|
|
80289
80317
|
async swap(params) {
|
|
80290
|
-
this.
|
|
80318
|
+
this.limits.assert({
|
|
80319
|
+
operation: "swap",
|
|
80320
|
+
amountUsd: approxUsdValue(params.from, params.amount) ?? 0,
|
|
80321
|
+
force: params.force
|
|
80322
|
+
});
|
|
80291
80323
|
const { findSwapRoute: findSwapRoute2, buildSwapTx: buildSwapTx2, resolveTokenType: resolveTokenType2 } = await Promise.resolve().then(() => (init_cetus_swap(), cetus_swap_exports));
|
|
80292
80324
|
const fromType = resolveTokenType2(params.from);
|
|
80293
80325
|
const toType = resolveTokenType2(params.to);
|
|
@@ -80379,6 +80411,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80379
80411
|
const fromName = resolveSymbol(fromType);
|
|
80380
80412
|
const toName = resolveSymbol(toType);
|
|
80381
80413
|
const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
|
|
80414
|
+
this.limits.record(approxUsdValue(params.from, params.amount) ?? 0);
|
|
80382
80415
|
return {
|
|
80383
80416
|
success: true,
|
|
80384
80417
|
tx: gasResult.digest,
|
|
@@ -80435,7 +80468,6 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80435
80468
|
* the "build via gRPC, execute via JSON-RPC" hybrid).
|
|
80436
80469
|
*/
|
|
80437
80470
|
async send(params) {
|
|
80438
|
-
this.enforcer.assertNotLocked();
|
|
80439
80471
|
const asset = params.asset;
|
|
80440
80472
|
if (!asset) {
|
|
80441
80473
|
throw new T2000Error(
|
|
@@ -80445,6 +80477,11 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80445
80477
|
}
|
|
80446
80478
|
assertAllowedAsset("send", asset);
|
|
80447
80479
|
const sendableAsset = asset;
|
|
80480
|
+
this.limits.assert({
|
|
80481
|
+
operation: "send",
|
|
80482
|
+
amountUsd: approxUsdValue(sendableAsset, params.amount) ?? 0,
|
|
80483
|
+
force: params.force
|
|
80484
|
+
});
|
|
80448
80485
|
const resolved = await this.resolveRecipient(params.to);
|
|
80449
80486
|
const sendAmount = params.amount;
|
|
80450
80487
|
const sendTo = resolved.address;
|
|
@@ -80456,7 +80493,7 @@ var T2000 = class _T2000 extends import_index2.default {
|
|
|
80456
80493
|
() => buildSendTx({ client: this.client, address: this._address, to: sendTo, amount: sendAmount, asset: sendableAsset }),
|
|
80457
80494
|
{ buildClient }
|
|
80458
80495
|
);
|
|
80459
|
-
this.
|
|
80496
|
+
this.limits.record(approxUsdValue(sendableAsset, sendAmount) ?? 0);
|
|
80460
80497
|
const balance = await this.balance();
|
|
80461
80498
|
this.emitBalanceChange(sendableAsset, sendAmount, "send", gasResult.digest);
|
|
80462
80499
|
return {
|
|
@@ -80617,12 +80654,18 @@ async function createAgent(keyPath) {
|
|
|
80617
80654
|
}
|
|
80618
80655
|
init_zod();
|
|
80619
80656
|
function mapError(err) {
|
|
80620
|
-
if (err instanceof
|
|
80657
|
+
if (err instanceof LimitExceededError) {
|
|
80621
80658
|
return {
|
|
80622
|
-
code:
|
|
80659
|
+
code: err.code,
|
|
80660
|
+
// 'LIMIT_EXCEEDED'
|
|
80623
80661
|
message: err.message,
|
|
80624
80662
|
retryable: false,
|
|
80625
|
-
details: {
|
|
80663
|
+
details: {
|
|
80664
|
+
operation: err.operation,
|
|
80665
|
+
limitKind: err.limitKind,
|
|
80666
|
+
limit: err.limit,
|
|
80667
|
+
attempted: err.attempted
|
|
80668
|
+
}
|
|
80626
80669
|
};
|
|
80627
80670
|
}
|
|
80628
80671
|
if (err instanceof T2000Error) {
|
|
@@ -80895,25 +80938,16 @@ ${text}`;
|
|
|
80895
80938
|
}
|
|
80896
80939
|
);
|
|
80897
80940
|
}
|
|
80898
|
-
function
|
|
80899
|
-
|
|
80900
|
-
|
|
80901
|
-
|
|
80902
|
-
|
|
80903
|
-
|
|
80904
|
-
|
|
80905
|
-
|
|
80906
|
-
|
|
80907
|
-
|
|
80908
|
-
if (typeof limits !== "object" || limits === null) return { configured: false, configPath: path };
|
|
80909
|
-
const l2 = limits;
|
|
80910
|
-
const perTxUsd = typeof l2.perTxUsd === "number" && l2.perTxUsd > 0 ? l2.perTxUsd : void 0;
|
|
80911
|
-
const dailySendUsd = typeof l2.dailySendUsd === "number" && l2.dailySendUsd > 0 ? l2.dailySendUsd : void 0;
|
|
80912
|
-
const configured = perTxUsd !== void 0 || dailySendUsd !== void 0;
|
|
80913
|
-
return { configured, perTxUsd, dailySendUsd, configPath: path };
|
|
80914
|
-
} catch {
|
|
80915
|
-
return { configured: false, configPath: path };
|
|
80916
|
-
}
|
|
80941
|
+
function readLimits(configDir) {
|
|
80942
|
+
const limits = getLimits(configDir);
|
|
80943
|
+
const perTxUsd = limits?.perTxUsd;
|
|
80944
|
+
const dailyUsd = limits?.dailyUsd;
|
|
80945
|
+
return {
|
|
80946
|
+
configured: perTxUsd !== void 0 || dailyUsd !== void 0,
|
|
80947
|
+
perTxUsd,
|
|
80948
|
+
dailyUsd,
|
|
80949
|
+
spentTodayUsd: dailySpentToday(configDir)
|
|
80950
|
+
};
|
|
80917
80951
|
}
|
|
80918
80952
|
function registerLimitTool(server) {
|
|
80919
80953
|
server.tool(
|
|
@@ -80926,7 +80960,7 @@ Use the returned values to inform the user about their own configured caps befor
|
|
|
80926
80960
|
{},
|
|
80927
80961
|
async () => {
|
|
80928
80962
|
try {
|
|
80929
|
-
const view =
|
|
80963
|
+
const view = readLimits();
|
|
80930
80964
|
return { content: [{ type: "text", text: JSON.stringify(view) }] };
|
|
80931
80965
|
} catch (err) {
|
|
80932
80966
|
return errorResult(err);
|
|
@@ -80972,7 +81006,7 @@ Through this wallet you can reach essentially any major external API, billed to
|
|
|
80972
81006
|
CRITICAL: When the user asks to use any external or paid API, names a provider (e.g. "via fal.ai", "with ElevenLabs"), or requests a capability one of the services above provides, DO NOT say you cannot reach that service, that it isn't on an allowlist, or that there's no connector \u2014 and do NOT fall back to writing a script for the user to run. You CAN do it directly through this wallet. Use t2000_services to discover the endpoint and request shape, then t2000_pay to execute, then show the user the result (display image/audio URLs returned in the response).
|
|
80973
81007
|
|
|
80974
81008
|
Spending is the user's own USDC and every t2000_pay call is bounded by maxPrice. 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; savings / lending live on audric.ai.`;
|
|
80975
|
-
var PKG_VERSION = "5.
|
|
81009
|
+
var PKG_VERSION = "5.3.0";
|
|
80976
81010
|
console.log = (...args) => console.error("[log]", ...args);
|
|
80977
81011
|
console.warn = (...args) => console.error("[warn]", ...args);
|
|
80978
81012
|
async function startMcpServer(opts) {
|
|
@@ -81038,4 +81072,4 @@ mime-types/index.js:
|
|
|
81038
81072
|
@scure/bip39/index.js:
|
|
81039
81073
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
81040
81074
|
*/
|
|
81041
|
-
//# sourceMappingURL=dist-
|
|
81075
|
+
//# sourceMappingURL=dist-U65BYMC5.js.map
|