ccusage 0.5.0 → 0.6.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 +65 -20
- package/dist/calculate-cost.d.ts +11 -8
- package/dist/{core-BgFXUe_h.js → core-B0ovMhJe.js} +4 -4
- package/dist/{data-loader-r5ZcMQy7.js → data-loader-DP5qBPn6.js} +153 -96
- package/dist/{data-loader-LMCrJ-lW.d.ts → data-loader-VdEcqJHc.d.ts} +28 -13
- package/dist/data-loader.d.ts +3 -5
- package/dist/data-loader.js +5 -5
- package/dist/{debug-BVxGf4UL.js → debug-C_5Qx11m.js} +13 -13
- package/dist/debug.d.ts +4 -4
- package/dist/debug.js +5 -5
- package/dist/{dist-FwNhpFrW.js → dist-C0-Tf5eD.js} +1 -92
- package/dist/{dist-C_i5I27w.js → dist-LwbOR2Yw.js} +5 -5
- package/dist/{effect-WSjEuzC9-BsxP11fz.js → effect-WSjEuzC9-CJfWUy0j.js} +1 -1
- package/dist/{esm-vjyZjnpZ.js → esm-Dqsc1zmX.js} +1 -1
- package/dist/{index-CISmcbXk-BotItq1T.js → index-CISmcbXk-DCA05NUL.js} +5 -5
- package/dist/index.js +246 -62
- package/dist/{logger-Cu4Ir1a5.js → logger-DsQC4OvA.js} +17 -17
- package/dist/logger.js +1 -1
- package/dist/{mcp-DAzj5Pua.js → mcp-BQdv12mr.js} +83 -74
- package/dist/mcp.d.ts +2 -4
- package/dist/mcp.js +7 -8
- package/dist/{pricing-fetcher-B5yPtoTB.js → pricing-fetcher-BPUgMrB_.js} +9 -9
- package/dist/{index-BurjgCfW.d.ts → pricing-fetcher-CfEgfzSr.d.ts} +19 -249
- package/dist/pricing-fetcher.d.ts +1 -2
- package/dist/pricing-fetcher.js +3 -3
- package/dist/{prompt-IToGuko2.js → prompt-DljZqwMa.js} +4 -4
- package/dist/{sury-DmrZ3_Oj-DhGOjCNc.js → sury-DmrZ3_Oj-CCL_DlTt.js} +1 -1
- package/dist/{types-CFnCBr2I.js → types-DS8M8QF_.js} +4 -4
- package/dist/{valibot-CQk-M5rL-Cq5E7F3g.js → valibot-CQk-M5rL-CkjrLVu1.js} +2 -2
- package/dist/{zod-Db63SLXj-BWdcigdx.js → zod-Db63SLXj-Dyc_OWjq.js} +3 -3
- package/package.json +8 -11
- package/dist/pricing-fetcher-DygIroMj.d.ts +0 -21
- package/dist/shared-args-DN3jRldX.js +0 -61
- package/dist/shared-args.d.ts +0 -94
- package/dist/shared-args.js +0 -8
- package/dist/types-B3ib19os.d.ts +0 -79
- package/dist/types-DFrbJmnT.js +0 -41
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -4
- package/dist/utils-C7kg8MXN.js +0 -10
- package/dist/utils.d.ts +0 -5
- package/dist/utils.js +0 -3
- /package/dist/{arktype-C-GObzDh-Dj1DVoqC.js → arktype-C-GObzDh-Bx7Fdrqj.js} +0 -0
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { __commonJS, __require, __toESM, getDefaultClaudePath,
|
|
2
|
-
import { description
|
|
3
|
-
import { name, version } from "./logger-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import process$1 from "node:process";
|
|
1
|
+
import { __commonJS, __require, __toESM, getDefaultClaudePath, loadDailyUsageData, loadSessionData } from "./data-loader-DP5qBPn6.js";
|
|
2
|
+
import { description, literal, object, optional, pipe, regex, string, union } from "./dist-C0-Tf5eD.js";
|
|
3
|
+
import { name, version } from "./logger-DsQC4OvA.js";
|
|
4
|
+
import { anyType, arrayType, booleanType, discriminatedUnionType, enumType, literalType, numberType, objectType, optionalType, recordType, stringType, unionType, unknownType } from "./types-DS8M8QF_.js";
|
|
5
|
+
import { toJsonSchema } from "./index-CISmcbXk-DCA05NUL.js";
|
|
6
|
+
import g$1 from "node:process";
|
|
8
7
|
import { EventEmitter } from "events";
|
|
9
8
|
import { randomUUID } from "node:crypto";
|
|
10
9
|
import { URL as URL$1 } from "url";
|
|
@@ -12,6 +11,16 @@ import http from "http";
|
|
|
12
11
|
import { randomUUID as randomUUID$1 } from "crypto";
|
|
13
12
|
import { setTimeout as setTimeout$1 } from "timers/promises";
|
|
14
13
|
|
|
14
|
+
//#region src/types.internal.ts
|
|
15
|
+
const dateSchema = pipe(string(), regex(/^\d{8}$/, "Date must be in YYYYMMDD format"));
|
|
16
|
+
const CostModes = [
|
|
17
|
+
"auto",
|
|
18
|
+
"calculate",
|
|
19
|
+
"display"
|
|
20
|
+
];
|
|
21
|
+
const SortOrders = ["desc", "asc"];
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
15
24
|
//#region node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
16
25
|
const LATEST_PROTOCOL_VERSION = "2025-03-26";
|
|
17
26
|
const SUPPORTED_PROTOCOL_VERSIONS = [
|
|
@@ -651,12 +660,12 @@ var Protocol = class {
|
|
|
651
660
|
constructor(_options) {
|
|
652
661
|
this._options = _options;
|
|
653
662
|
this._requestMessageId = 0;
|
|
654
|
-
this._requestHandlers = new Map();
|
|
655
|
-
this._requestHandlerAbortControllers = new Map();
|
|
656
|
-
this._notificationHandlers = new Map();
|
|
657
|
-
this._responseHandlers = new Map();
|
|
658
|
-
this._progressHandlers = new Map();
|
|
659
|
-
this._timeoutInfo = new Map();
|
|
663
|
+
this._requestHandlers = /* @__PURE__ */ new Map();
|
|
664
|
+
this._requestHandlerAbortControllers = /* @__PURE__ */ new Map();
|
|
665
|
+
this._notificationHandlers = /* @__PURE__ */ new Map();
|
|
666
|
+
this._responseHandlers = /* @__PURE__ */ new Map();
|
|
667
|
+
this._progressHandlers = /* @__PURE__ */ new Map();
|
|
668
|
+
this._timeoutInfo = /* @__PURE__ */ new Map();
|
|
660
669
|
this.setNotificationHandler(CancelledNotificationSchema, (notification) => {
|
|
661
670
|
const controller = this._requestHandlerAbortControllers.get(notification.params.requestId);
|
|
662
671
|
controller === null || controller === void 0 || controller.abort(notification.params.reason);
|
|
@@ -722,7 +731,7 @@ var Protocol = class {
|
|
|
722
731
|
_onclose() {
|
|
723
732
|
var _a;
|
|
724
733
|
const responseHandlers = this._responseHandlers;
|
|
725
|
-
this._responseHandlers = new Map();
|
|
734
|
+
this._responseHandlers = /* @__PURE__ */ new Map();
|
|
726
735
|
this._progressHandlers.clear();
|
|
727
736
|
this._transport = void 0;
|
|
728
737
|
(_a = this.onclose) === null || _a === void 0 || _a.call(this);
|
|
@@ -1182,7 +1191,7 @@ function serializeMessage(message) {
|
|
|
1182
1191
|
* This transport is only available in Node.js environments.
|
|
1183
1192
|
*/
|
|
1184
1193
|
var StdioServerTransport = class {
|
|
1185
|
-
constructor(_stdin =
|
|
1194
|
+
constructor(_stdin = g$1.stdin, _stdout = g$1.stdout) {
|
|
1186
1195
|
this._stdin = _stdin;
|
|
1187
1196
|
this._stdout = _stdout;
|
|
1188
1197
|
this._readBuffer = new ReadBuffer();
|
|
@@ -1399,7 +1408,7 @@ var Config = {
|
|
|
1399
1408
|
};
|
|
1400
1409
|
const SPACE$1 = /[^ ]+/g;
|
|
1401
1410
|
function norm(weight = 1, mantissa = 3) {
|
|
1402
|
-
const cache = new Map();
|
|
1411
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1403
1412
|
const m = Math.pow(10, mantissa);
|
|
1404
1413
|
return {
|
|
1405
1414
|
get(value) {
|
|
@@ -2683,7 +2692,7 @@ var require_depd = __commonJS({ "node_modules/depd/index.js"(exports, module) {
|
|
|
2683
2692
|
* Format deprecation message without color.
|
|
2684
2693
|
*/
|
|
2685
2694
|
function formatPlain(msg, caller, stack) {
|
|
2686
|
-
var timestamp = new Date().toUTCString();
|
|
2695
|
+
var timestamp = (/* @__PURE__ */ new Date()).toUTCString();
|
|
2687
2696
|
var formatted = timestamp + " " + this._namespace + " deprecated " + msg;
|
|
2688
2697
|
if (this._traced) {
|
|
2689
2698
|
for (var i$3 = 0; i$3 < stack.length; i$3++) formatted += "\n at " + stack[i$3].toString();
|
|
@@ -12086,8 +12095,8 @@ var require_raw_body = __commonJS({ "node_modules/raw-body/index.js"(exports, mo
|
|
|
12086
12095
|
type: "request.size.invalid"
|
|
12087
12096
|
}));
|
|
12088
12097
|
else {
|
|
12089
|
-
var string = decoder ? buffer$2 + (decoder.end() || "") : Buffer.concat(buffer$2);
|
|
12090
|
-
done(null, string);
|
|
12098
|
+
var string$1 = decoder ? buffer$2 + (decoder.end() || "") : Buffer.concat(buffer$2);
|
|
12099
|
+
done(null, string$1);
|
|
12091
12100
|
}
|
|
12092
12101
|
}
|
|
12093
12102
|
function cleanup() {
|
|
@@ -12180,17 +12189,17 @@ var require_content_type = __commonJS({ "node_modules/content-type/index.js"(exp
|
|
|
12180
12189
|
var parameters = obj.parameters;
|
|
12181
12190
|
var type = obj.type;
|
|
12182
12191
|
if (!type || !TYPE_REGEXP.test(type)) throw new TypeError("invalid type");
|
|
12183
|
-
var string = type;
|
|
12192
|
+
var string$1 = type;
|
|
12184
12193
|
if (parameters && typeof parameters === "object") {
|
|
12185
12194
|
var param;
|
|
12186
12195
|
var params = Object.keys(parameters).sort();
|
|
12187
12196
|
for (var i$3 = 0; i$3 < params.length; i$3++) {
|
|
12188
12197
|
param = params[i$3];
|
|
12189
12198
|
if (!TOKEN_REGEXP.test(param)) throw new TypeError("invalid parameter name");
|
|
12190
|
-
string += "; " + param + "=" + qstring(parameters[param]);
|
|
12199
|
+
string$1 += "; " + param + "=" + qstring(parameters[param]);
|
|
12191
12200
|
}
|
|
12192
12201
|
}
|
|
12193
|
-
return string;
|
|
12202
|
+
return string$1;
|
|
12194
12203
|
}
|
|
12195
12204
|
/**
|
|
12196
12205
|
* Parse media type to object.
|
|
@@ -12199,9 +12208,9 @@ var require_content_type = __commonJS({ "node_modules/content-type/index.js"(exp
|
|
|
12199
12208
|
* @return {Object}
|
|
12200
12209
|
* @public
|
|
12201
12210
|
*/
|
|
12202
|
-
function parse(string) {
|
|
12203
|
-
if (!string) throw new TypeError("argument string is required");
|
|
12204
|
-
var header = typeof string === "object" ? getcontenttype(string) : string;
|
|
12211
|
+
function parse(string$1) {
|
|
12212
|
+
if (!string$1) throw new TypeError("argument string is required");
|
|
12213
|
+
var header = typeof string$1 === "object" ? getcontenttype(string$1) : string$1;
|
|
12205
12214
|
if (typeof header !== "string") throw new TypeError("argument string is required to be a string");
|
|
12206
12215
|
var index = header.indexOf(";");
|
|
12207
12216
|
var type = index !== -1 ? header.slice(0, index).trim() : header.trim();
|
|
@@ -12322,7 +12331,7 @@ var SSEServerTransport = class {
|
|
|
12322
12331
|
const authInfo = req.auth;
|
|
12323
12332
|
let body;
|
|
12324
12333
|
try {
|
|
12325
|
-
const ct = import_content_type$1.
|
|
12334
|
+
const ct = import_content_type$1.parse((_a = req.headers["content-type"]) !== null && _a !== void 0 ? _a : "");
|
|
12326
12335
|
if (ct.type !== "application/json") throw new Error(`Unsupported content-type: ${ct}`);
|
|
12327
12336
|
body = parsedBody !== null && parsedBody !== void 0 ? parsedBody : await (0, import_raw_body$1.default)(req, {
|
|
12328
12337
|
limit: MAXIMUM_MESSAGE_SIZE$1,
|
|
@@ -12418,9 +12427,9 @@ var StreamableHTTPServerTransport = class {
|
|
|
12418
12427
|
constructor(options) {
|
|
12419
12428
|
var _a;
|
|
12420
12429
|
this._started = false;
|
|
12421
|
-
this._streamMapping = new Map();
|
|
12422
|
-
this._requestToStreamMapping = new Map();
|
|
12423
|
-
this._requestResponseMap = new Map();
|
|
12430
|
+
this._streamMapping = /* @__PURE__ */ new Map();
|
|
12431
|
+
this._requestToStreamMapping = /* @__PURE__ */ new Map();
|
|
12432
|
+
this._requestResponseMap = /* @__PURE__ */ new Map();
|
|
12424
12433
|
this._initialized = false;
|
|
12425
12434
|
this._enableJsonResponse = false;
|
|
12426
12435
|
this._standaloneSseStreamId = "_GET_stream";
|
|
@@ -12576,7 +12585,7 @@ var StreamableHTTPServerTransport = class {
|
|
|
12576
12585
|
let rawMessage;
|
|
12577
12586
|
if (parsedBody !== void 0) rawMessage = parsedBody;
|
|
12578
12587
|
else {
|
|
12579
|
-
const parsedCt = import_content_type.
|
|
12588
|
+
const parsedCt = import_content_type.parse(ct);
|
|
12580
12589
|
const body = await (0, import_raw_body.default)(req, {
|
|
12581
12590
|
limit: MAXIMUM_MESSAGE_SIZE,
|
|
12582
12591
|
encoding: (_a = parsedCt.parameters.charset) !== null && _a !== void 0 ? _a : "utf-8"
|
|
@@ -13227,15 +13236,15 @@ var require_uri_all = __commonJS({ "node_modules/uri-js/dist/es5/uri.all.js"(exp
|
|
|
13227
13236
|
* @returns {Array} A new string of characters returned by the callback
|
|
13228
13237
|
* function.
|
|
13229
13238
|
*/
|
|
13230
|
-
function mapDomain(string, fn) {
|
|
13231
|
-
var parts = string.split("@");
|
|
13239
|
+
function mapDomain(string$1, fn) {
|
|
13240
|
+
var parts = string$1.split("@");
|
|
13232
13241
|
var result = "";
|
|
13233
13242
|
if (parts.length > 1) {
|
|
13234
13243
|
result = parts[0] + "@";
|
|
13235
|
-
string = parts[1];
|
|
13244
|
+
string$1 = parts[1];
|
|
13236
13245
|
}
|
|
13237
|
-
string = string.replace(regexSeparators, ".");
|
|
13238
|
-
var labels = string.split(".");
|
|
13246
|
+
string$1 = string$1.replace(regexSeparators, ".");
|
|
13247
|
+
var labels = string$1.split(".");
|
|
13239
13248
|
var encoded = map$1(labels, fn).join(".");
|
|
13240
13249
|
return result + encoded;
|
|
13241
13250
|
}
|
|
@@ -13252,14 +13261,14 @@ var require_uri_all = __commonJS({ "node_modules/uri-js/dist/es5/uri.all.js"(exp
|
|
|
13252
13261
|
* @param {String} string The Unicode input string (UCS-2).
|
|
13253
13262
|
* @returns {Array} The new array of code points.
|
|
13254
13263
|
*/
|
|
13255
|
-
function ucs2decode(string) {
|
|
13264
|
+
function ucs2decode(string$1) {
|
|
13256
13265
|
var output = [];
|
|
13257
13266
|
var counter = 0;
|
|
13258
|
-
var length = string.length;
|
|
13267
|
+
var length = string$1.length;
|
|
13259
13268
|
while (counter < length) {
|
|
13260
|
-
var value = string.charCodeAt(counter++);
|
|
13269
|
+
var value = string$1.charCodeAt(counter++);
|
|
13261
13270
|
if (value >= 55296 && value <= 56319 && counter < length) {
|
|
13262
|
-
var extra = string.charCodeAt(counter++);
|
|
13271
|
+
var extra = string$1.charCodeAt(counter++);
|
|
13263
13272
|
if ((extra & 64512) == 56320) output.push(((value & 1023) << 10) + (extra & 1023) + 65536);
|
|
13264
13273
|
else {
|
|
13265
13274
|
output.push(value);
|
|
@@ -13471,8 +13480,8 @@ var require_uri_all = __commonJS({ "node_modules/uri-js/dist/es5/uri.all.js"(exp
|
|
|
13471
13480
|
* string.
|
|
13472
13481
|
*/
|
|
13473
13482
|
var toUnicode = function toUnicode$1(input) {
|
|
13474
|
-
return mapDomain(input, function(string) {
|
|
13475
|
-
return regexPunycode.test(string) ? decode(string.slice(4).toLowerCase()) : string;
|
|
13483
|
+
return mapDomain(input, function(string$1) {
|
|
13484
|
+
return regexPunycode.test(string$1) ? decode(string$1.slice(4).toLowerCase()) : string$1;
|
|
13476
13485
|
});
|
|
13477
13486
|
};
|
|
13478
13487
|
/**
|
|
@@ -13487,8 +13496,8 @@ var require_uri_all = __commonJS({ "node_modules/uri-js/dist/es5/uri.all.js"(exp
|
|
|
13487
13496
|
* email address.
|
|
13488
13497
|
*/
|
|
13489
13498
|
var toASCII = function toASCII$1(input) {
|
|
13490
|
-
return mapDomain(input, function(string) {
|
|
13491
|
-
return regexNonASCII.test(string) ? "xn--" + encode(string) : string;
|
|
13499
|
+
return mapDomain(input, function(string$1) {
|
|
13500
|
+
return regexNonASCII.test(string$1) ? "xn--" + encode(string$1) : string$1;
|
|
13492
13501
|
});
|
|
13493
13502
|
};
|
|
13494
13503
|
/** Define the public API */
|
|
@@ -15360,7 +15369,7 @@ var require_formats = __commonJS({ "node_modules/ajv/lib/compile/formats.js"(exp
|
|
|
15360
15369
|
hostname: HOSTNAME,
|
|
15361
15370
|
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
|
15362
15371
|
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
|
15363
|
-
regex,
|
|
15372
|
+
regex: regex$1,
|
|
15364
15373
|
uuid: UUID,
|
|
15365
15374
|
"json-pointer": JSON_POINTER,
|
|
15366
15375
|
"json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT,
|
|
@@ -15378,7 +15387,7 @@ var require_formats = __commonJS({ "node_modules/ajv/lib/compile/formats.js"(exp
|
|
|
15378
15387
|
hostname: HOSTNAME,
|
|
15379
15388
|
ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
|
|
15380
15389
|
ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i,
|
|
15381
|
-
regex,
|
|
15390
|
+
regex: regex$1,
|
|
15382
15391
|
uuid: UUID,
|
|
15383
15392
|
"json-pointer": JSON_POINTER,
|
|
15384
15393
|
"json-pointer-uri-fragment": JSON_POINTER_URI_FRAGMENT,
|
|
@@ -15414,7 +15423,7 @@ var require_formats = __commonJS({ "node_modules/ajv/lib/compile/formats.js"(exp
|
|
|
15414
15423
|
return NOT_URI_FRAGMENT.test(str) && URI.test(str);
|
|
15415
15424
|
}
|
|
15416
15425
|
var Z_ANCHOR = /[^\\]\\Z/;
|
|
15417
|
-
function regex(str) {
|
|
15426
|
+
function regex$1(str) {
|
|
15418
15427
|
if (Z_ANCHOR.test(str)) return false;
|
|
15419
15428
|
try {
|
|
15420
15429
|
new RegExp(str);
|
|
@@ -18224,10 +18233,10 @@ var require_ajv = __commonJS({ "node_modules/ajv/lib/ajv.js"(exports, module) {
|
|
|
18224
18233
|
}
|
|
18225
18234
|
return this;
|
|
18226
18235
|
}
|
|
18227
|
-
function _removeAllSchemas(self, schemas, regex$
|
|
18236
|
+
function _removeAllSchemas(self, schemas, regex$2) {
|
|
18228
18237
|
for (var keyRef in schemas) {
|
|
18229
18238
|
var schemaObj = schemas[keyRef];
|
|
18230
|
-
if (!schemaObj.meta && (!regex$
|
|
18239
|
+
if (!schemaObj.meta && (!regex$2 || regex$2.test(keyRef))) {
|
|
18231
18240
|
self._cache.del(schemaObj.cacheKey);
|
|
18232
18241
|
delete schemas[keyRef];
|
|
18233
18242
|
}
|
|
@@ -20668,7 +20677,7 @@ var require_connect = __commonJS({ "node_modules/undici/lib/core/connect.js"(exp
|
|
|
20668
20677
|
if (global.FinalizationRegistry && !(process.env.NODE_V8_COVERAGE || process.env.UNDICI_NO_FG)) SessionCache = class WeakSessionCache {
|
|
20669
20678
|
constructor(maxCachedSessions) {
|
|
20670
20679
|
this._maxCachedSessions = maxCachedSessions;
|
|
20671
|
-
this._sessionCache = new Map();
|
|
20680
|
+
this._sessionCache = /* @__PURE__ */ new Map();
|
|
20672
20681
|
this._sessionRegistry = new global.FinalizationRegistry((key$1) => {
|
|
20673
20682
|
if (this._sessionCache.size < this._maxCachedSessions) return;
|
|
20674
20683
|
const ref = this._sessionCache.get(key$1);
|
|
@@ -20688,7 +20697,7 @@ var require_connect = __commonJS({ "node_modules/undici/lib/core/connect.js"(exp
|
|
|
20688
20697
|
else SessionCache = class SimpleSessionCache {
|
|
20689
20698
|
constructor(maxCachedSessions) {
|
|
20690
20699
|
this._maxCachedSessions = maxCachedSessions;
|
|
20691
|
-
this._sessionCache = new Map();
|
|
20700
|
+
this._sessionCache = /* @__PURE__ */ new Map();
|
|
20692
20701
|
}
|
|
20693
20702
|
get(sessionKey) {
|
|
20694
20703
|
return this._sessionCache.get(sessionKey);
|
|
@@ -21756,7 +21765,7 @@ var require_data_url = __commonJS({ "node_modules/undici/lib/web/fetch/data-url.
|
|
|
21756
21765
|
const mimeType = {
|
|
21757
21766
|
type: typeLowercase,
|
|
21758
21767
|
subtype: subtypeLowercase,
|
|
21759
|
-
parameters: new Map(),
|
|
21768
|
+
parameters: /* @__PURE__ */ new Map(),
|
|
21760
21769
|
essence: `${typeLowercase}/${subtypeLowercase}`
|
|
21761
21770
|
};
|
|
21762
21771
|
while (position.position < input.length) {
|
|
@@ -26004,7 +26013,7 @@ var require_agent = __commonJS({ "node_modules/undici/lib/dispatcher/agent.js"(e
|
|
|
26004
26013
|
connect: connect$3
|
|
26005
26014
|
};
|
|
26006
26015
|
this[kFactory$1] = factory;
|
|
26007
|
-
this[kClients$1] = new Map();
|
|
26016
|
+
this[kClients$1] = /* @__PURE__ */ new Map();
|
|
26008
26017
|
this[kOnDrain] = (origin, targets) => {
|
|
26009
26018
|
this.emit("drain", origin, [this, ...targets]);
|
|
26010
26019
|
};
|
|
@@ -29041,7 +29050,7 @@ var require_dns = __commonJS({ "node_modules/undici/lib/interceptor/dns.js"(expo
|
|
|
29041
29050
|
var DNSInstance = class {
|
|
29042
29051
|
#maxTTL = 0;
|
|
29043
29052
|
#maxItems = 0;
|
|
29044
|
-
#records = new Map();
|
|
29053
|
+
#records = /* @__PURE__ */ new Map();
|
|
29045
29054
|
dualStack = true;
|
|
29046
29055
|
affinity = null;
|
|
29047
29056
|
lookup = null;
|
|
@@ -29107,7 +29116,7 @@ var require_dns = __commonJS({ "node_modules/undici/lib/interceptor/dns.js"(expo
|
|
|
29107
29116
|
order: "ipv4first"
|
|
29108
29117
|
}, (err, addresses) => {
|
|
29109
29118
|
if (err) return cb(err);
|
|
29110
|
-
const results = new Map();
|
|
29119
|
+
const results = /* @__PURE__ */ new Map();
|
|
29111
29120
|
for (const addr of addresses) results.set(`${addr.address}:${addr.family}`, addr);
|
|
29112
29121
|
cb(null, results.values());
|
|
29113
29122
|
});
|
|
@@ -29625,7 +29634,7 @@ var require_date = __commonJS({ "node_modules/undici/lib/util/date.js"(exports,
|
|
|
29625
29634
|
* @param {Date} [now]
|
|
29626
29635
|
* @returns {Date | undefined}
|
|
29627
29636
|
*/
|
|
29628
|
-
function parseRfc850Date(date$1, now = new Date()) {
|
|
29637
|
+
function parseRfc850Date(date$1, now = /* @__PURE__ */ new Date()) {
|
|
29629
29638
|
if (!date$1.endsWith("gmt")) return void 0;
|
|
29630
29639
|
const commaIndex = date$1.indexOf(",");
|
|
29631
29640
|
if (commaIndex === -1) return void 0;
|
|
@@ -29949,7 +29958,7 @@ var require_memory_cache_store = __commonJS({ "node_modules/undici/lib/cache/mem
|
|
|
29949
29958
|
#maxEntrySize = Infinity;
|
|
29950
29959
|
#size = 0;
|
|
29951
29960
|
#count = 0;
|
|
29952
|
-
#entries = new Map();
|
|
29961
|
+
#entries = /* @__PURE__ */ new Map();
|
|
29953
29962
|
#hasEmittedMaxSizeEvent = false;
|
|
29954
29963
|
/**
|
|
29955
29964
|
* @param {import('../../types/cache-interceptor.d.ts').default.MemoryCacheStoreOpts | undefined} [opts]
|
|
@@ -31496,7 +31505,7 @@ var require_request = __commonJS({ "node_modules/undici/lib/web/fetch/request.js
|
|
|
31496
31505
|
const requestFinalizer = new FinalizationRegistry$1(({ signal, abort: abort$1 }) => {
|
|
31497
31506
|
signal.removeEventListener("abort", abort$1);
|
|
31498
31507
|
});
|
|
31499
|
-
const dependentControllerMap = new WeakMap();
|
|
31508
|
+
const dependentControllerMap = /* @__PURE__ */ new WeakMap();
|
|
31500
31509
|
let abortSignalHasEventHandlerLeakWarning;
|
|
31501
31510
|
try {
|
|
31502
31511
|
abortSignalHasEventHandlerLeakWarning = getMaxListeners(new AbortController().signal) > 0;
|
|
@@ -31786,7 +31795,7 @@ var require_request = __commonJS({ "node_modules/undici/lib/web/fetch/request.js
|
|
|
31786
31795
|
else {
|
|
31787
31796
|
let list = dependentControllerMap.get(this.signal);
|
|
31788
31797
|
if (list === void 0) {
|
|
31789
|
-
list = new Set();
|
|
31798
|
+
list = /* @__PURE__ */ new Set();
|
|
31790
31799
|
dependentControllerMap.set(this.signal, list);
|
|
31791
31800
|
}
|
|
31792
31801
|
const acRef = new WeakRef(ac);
|
|
@@ -33255,7 +33264,7 @@ var require_cachestorage = __commonJS({ "node_modules/undici/lib/web/cache/cache
|
|
|
33255
33264
|
* @see https://w3c.github.io/ServiceWorker/#dfn-relevant-name-to-cache-map
|
|
33256
33265
|
* @type {Map<string, import('./cache').requestResponseList}
|
|
33257
33266
|
*/
|
|
33258
|
-
#caches = new Map();
|
|
33267
|
+
#caches = /* @__PURE__ */ new Map();
|
|
33259
33268
|
constructor() {
|
|
33260
33269
|
if (arguments[0] !== kConstruct$3) webidl$6.illegalConstructor();
|
|
33261
33270
|
webidl$6.util.markAsUncloneable(this);
|
|
@@ -33711,7 +33720,7 @@ var require_cookies = __commonJS({ "node_modules/undici/lib/web/cookies/index.js
|
|
|
33711
33720
|
setCookie$1(headers, {
|
|
33712
33721
|
name: name$1,
|
|
33713
33722
|
value: "",
|
|
33714
|
-
expires: new Date(0),
|
|
33723
|
+
expires: /* @__PURE__ */ new Date(0),
|
|
33715
33724
|
...attributes
|
|
33716
33725
|
});
|
|
33717
33726
|
}
|
|
@@ -34329,7 +34338,7 @@ var require_util$1 = __commonJS({ "node_modules/undici/lib/web/websocket/util.js
|
|
|
34329
34338
|
*/
|
|
34330
34339
|
function parseExtensions$1(extensions) {
|
|
34331
34340
|
const position = { position: 0 };
|
|
34332
|
-
const extensionList = new Map();
|
|
34341
|
+
const extensionList = /* @__PURE__ */ new Map();
|
|
34333
34342
|
while (position.position < extensions.length) {
|
|
34334
34343
|
const pair = collectASequenceOfCodePointsFast(";", extensions, position);
|
|
34335
34344
|
const [name$1, value = ""] = pair.split("=", 2);
|
|
@@ -34755,7 +34764,7 @@ var require_receiver = __commonJS({ "node_modules/undici/lib/web/websocket/recei
|
|
|
34755
34764
|
constructor(handler, extensions) {
|
|
34756
34765
|
super();
|
|
34757
34766
|
this.#handler = handler;
|
|
34758
|
-
this.#extensions = extensions == null ? new Map() : extensions;
|
|
34767
|
+
this.#extensions = extensions == null ? /* @__PURE__ */ new Map() : extensions;
|
|
34759
34768
|
if (this.#extensions.has("permessage-deflate")) this.#extensions.set("permessage-deflate", new PerMessageDeflate(extensions));
|
|
34760
34769
|
}
|
|
34761
34770
|
/**
|
|
@@ -35162,7 +35171,7 @@ var require_websocket = __commonJS({ "node_modules/undici/lib/web/websocket/webs
|
|
|
35162
35171
|
onSocketClose: () => this.#onSocketClose(),
|
|
35163
35172
|
readyState: states$1.CONNECTING,
|
|
35164
35173
|
socket: null,
|
|
35165
|
-
closeState: new Set(),
|
|
35174
|
+
closeState: /* @__PURE__ */ new Set(),
|
|
35166
35175
|
controller: null,
|
|
35167
35176
|
wasEverConnected: false
|
|
35168
35177
|
};
|
|
@@ -35570,7 +35579,7 @@ var require_websocketstream = __commonJS({ "node_modules/undici/lib/web/websocke
|
|
|
35570
35579
|
onSocketClose: () => this.#onSocketClose(),
|
|
35571
35580
|
readyState: states.CONNECTING,
|
|
35572
35581
|
socket: null,
|
|
35573
|
-
closeState: new Set(),
|
|
35582
|
+
closeState: /* @__PURE__ */ new Set(),
|
|
35574
35583
|
controller: null,
|
|
35575
35584
|
wasEverConnected: false
|
|
35576
35585
|
};
|
|
@@ -35635,14 +35644,14 @@ var require_websocketstream = __commonJS({ "node_modules/undici/lib/web/websocke
|
|
|
35635
35644
|
data = new Uint8Array(ArrayBuffer.isView(chunk) ? new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength) : chunk);
|
|
35636
35645
|
opcode = opcodes.BINARY;
|
|
35637
35646
|
} else {
|
|
35638
|
-
let string;
|
|
35647
|
+
let string$1;
|
|
35639
35648
|
try {
|
|
35640
|
-
string = webidl$1.converters.DOMString(chunk);
|
|
35649
|
+
string$1 = webidl$1.converters.DOMString(chunk);
|
|
35641
35650
|
} catch (e) {
|
|
35642
35651
|
promise.reject(e);
|
|
35643
35652
|
return;
|
|
35644
35653
|
}
|
|
35645
|
-
data = new TextEncoder().encode(string);
|
|
35654
|
+
data = new TextEncoder().encode(string$1);
|
|
35646
35655
|
opcode = opcodes.TEXT;
|
|
35647
35656
|
}
|
|
35648
35657
|
if (!this.#handler.closeState.has(sentCloseFrameState.SENT) && !this.#handler.closeState.has(sentCloseFrameState.RECEIVED)) {
|
|
@@ -36498,14 +36507,14 @@ var require_uri_templates = __commonJS({ "node_modules/uri-templates/uri-templat
|
|
|
36498
36507
|
};
|
|
36499
36508
|
var uriTemplateSuffices = { "*": true };
|
|
36500
36509
|
var urlEscapedChars = /[:/&?#]/;
|
|
36501
|
-
function notReallyPercentEncode(string) {
|
|
36502
|
-
return encodeURI(string).replace(/%25[0-9][0-9]/g, function(doubleEncoded) {
|
|
36510
|
+
function notReallyPercentEncode(string$1) {
|
|
36511
|
+
return encodeURI(string$1).replace(/%25[0-9][0-9]/g, function(doubleEncoded) {
|
|
36503
36512
|
return "%" + doubleEncoded.substring(3);
|
|
36504
36513
|
});
|
|
36505
36514
|
}
|
|
36506
|
-
function isPercentEncoded(string) {
|
|
36507
|
-
string = string.replace(/%../g, "");
|
|
36508
|
-
return encodeURIComponent(string) === string;
|
|
36515
|
+
function isPercentEncoded(string$1) {
|
|
36516
|
+
string$1 = string$1.replace(/%../g, "");
|
|
36517
|
+
return encodeURIComponent(string$1) === string$1;
|
|
36509
36518
|
}
|
|
36510
36519
|
function uriTemplateSubstitution(spec) {
|
|
36511
36520
|
var modifier = "";
|
|
@@ -37554,7 +37563,7 @@ function createMcpServer({ claudePath } = defaultOptions) {
|
|
|
37554
37563
|
description: "Show usage report grouped by date",
|
|
37555
37564
|
parameters: parametersSchema,
|
|
37556
37565
|
execute: async (args) => {
|
|
37557
|
-
const dailyData = await
|
|
37566
|
+
const dailyData = await loadDailyUsageData({
|
|
37558
37567
|
...args,
|
|
37559
37568
|
claudePath
|
|
37560
37569
|
});
|
|
@@ -37577,4 +37586,4 @@ function createMcpServer({ claudePath } = defaultOptions) {
|
|
|
37577
37586
|
}
|
|
37578
37587
|
|
|
37579
37588
|
//#endregion
|
|
37580
|
-
export { createMcpServer };
|
|
37589
|
+
export { CostModes, SortOrders, createMcpServer, dateSchema };
|
package/dist/mcp.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./types-B3ib19os.js";
|
|
4
|
-
import { LoadOptions } from "./data-loader-LMCrJ-lW.js";
|
|
1
|
+
import "./pricing-fetcher-CfEgfzSr.js";
|
|
2
|
+
import { LoadOptions } from "./data-loader-VdEcqJHc.js";
|
|
5
3
|
import { FastMCP } from "fastmcp";
|
|
6
4
|
|
|
7
5
|
//#region src/mcp.d.ts
|
package/dist/mcp.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import "./data-loader-
|
|
2
|
-
import "./dist-
|
|
3
|
-
import "./logger-
|
|
4
|
-
import "./pricing-fetcher-
|
|
5
|
-
import "./
|
|
6
|
-
import "./types-
|
|
7
|
-
import
|
|
8
|
-
import "./index-CISmcbXk-BotItq1T.js";
|
|
1
|
+
import "./data-loader-DP5qBPn6.js";
|
|
2
|
+
import "./dist-C0-Tf5eD.js";
|
|
3
|
+
import "./logger-DsQC4OvA.js";
|
|
4
|
+
import "./pricing-fetcher-BPUgMrB_.js";
|
|
5
|
+
import { createMcpServer } from "./mcp-BQdv12mr.js";
|
|
6
|
+
import "./types-DS8M8QF_.js";
|
|
7
|
+
import "./index-CISmcbXk-DCA05NUL.js";
|
|
9
8
|
|
|
10
9
|
export { createMcpServer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { number, object, optional, parse } from "./dist-
|
|
2
|
-
import { logger } from "./logger-
|
|
1
|
+
import { number, object, optional, parse } from "./dist-C0-Tf5eD.js";
|
|
2
|
+
import { logger } from "./logger-DsQC4OvA.js";
|
|
3
3
|
|
|
4
4
|
//#region src/pricing-fetcher.ts
|
|
5
5
|
const ModelPricingSchema = object({
|
|
@@ -14,7 +14,7 @@ function clearPricingCache() {
|
|
|
14
14
|
cachedPricing = null;
|
|
15
15
|
}
|
|
16
16
|
async function fetchModelPricing() {
|
|
17
|
-
if (cachedPricing) return cachedPricing;
|
|
17
|
+
if (cachedPricing != null) return cachedPricing;
|
|
18
18
|
try {
|
|
19
19
|
logger.warn("Fetching latest model pricing from LiteLLM...");
|
|
20
20
|
const response = await fetch(LITELLM_PRICING_URL);
|
|
@@ -34,7 +34,7 @@ async function fetchModelPricing() {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
function getModelPricing(modelName, pricing) {
|
|
37
|
-
if (pricing[modelName]) return pricing[modelName];
|
|
37
|
+
if (pricing[modelName] != null) return pricing[modelName];
|
|
38
38
|
const variations = [
|
|
39
39
|
modelName,
|
|
40
40
|
`anthropic/${modelName}`,
|
|
@@ -42,17 +42,17 @@ function getModelPricing(modelName, pricing) {
|
|
|
42
42
|
`claude-3-${modelName}`,
|
|
43
43
|
`claude-${modelName}`
|
|
44
44
|
];
|
|
45
|
-
for (const variant of variations) if (pricing[variant]) return pricing[variant];
|
|
45
|
+
for (const variant of variations) if (pricing[variant] != null) return pricing[variant];
|
|
46
46
|
const lowerModel = modelName.toLowerCase();
|
|
47
47
|
for (const [key, value] of Object.entries(pricing)) if (key.toLowerCase().includes(lowerModel) || lowerModel.includes(key.toLowerCase())) return value;
|
|
48
48
|
return null;
|
|
49
49
|
}
|
|
50
50
|
function calculateCostFromTokens(tokens, pricing) {
|
|
51
51
|
let cost = 0;
|
|
52
|
-
if (pricing.input_cost_per_token) cost += tokens.input_tokens * pricing.input_cost_per_token;
|
|
53
|
-
if (pricing.output_cost_per_token) cost += tokens.output_tokens * pricing.output_cost_per_token;
|
|
54
|
-
if (tokens.cache_creation_input_tokens && pricing.cache_creation_input_token_cost) cost += tokens.cache_creation_input_tokens * pricing.cache_creation_input_token_cost;
|
|
55
|
-
if (tokens.cache_read_input_tokens && pricing.cache_read_input_token_cost) cost += tokens.cache_read_input_tokens * pricing.cache_read_input_token_cost;
|
|
52
|
+
if (pricing.input_cost_per_token != null) cost += tokens.input_tokens * pricing.input_cost_per_token;
|
|
53
|
+
if (pricing.output_cost_per_token != null) cost += tokens.output_tokens * pricing.output_cost_per_token;
|
|
54
|
+
if (tokens.cache_creation_input_tokens != null && pricing.cache_creation_input_token_cost != null) cost += tokens.cache_creation_input_tokens * pricing.cache_creation_input_token_cost;
|
|
55
|
+
if (tokens.cache_read_input_tokens != null && pricing.cache_read_input_token_cost != null) cost += tokens.cache_read_input_tokens * pricing.cache_read_input_token_cost;
|
|
56
56
|
return cost;
|
|
57
57
|
}
|
|
58
58
|
|