ccusage 0.8.0 → 9.0.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 +25 -5
- package/dist/calculate-cost.d.ts +2 -2
- package/dist/chunk-BLXvPPr8.js +30 -0
- package/dist/{data-loader-Bz6Vemxw.js → data-loader-Ca8k_uX0.js} +235 -294
- package/dist/{data-loader-amTZCtBR.d.ts → data-loader-OGaMjZTD.d.ts} +8 -80
- package/dist/data-loader.d.ts +3 -3
- package/dist/data-loader.js +5 -5
- package/dist/{debug-DQXeZIjf.js → debug-zCcXwR8p.js} +5 -4
- package/dist/debug.js +5 -5
- package/dist/{dist-DAarI-SJ.js → dist-BZzwBtZs.js} +1 -1
- package/dist/{effect-WSjEuzC9-ChJ5OQQf.js → effect-WSjEuzC9-DHMVzzyB.js} +1 -1
- package/dist/{esm-Dqsc1zmX.js → esm-BU3FhOe-.js} +1 -1
- package/dist/{index-CISmcbXk-x9eVmhGM.js → index-CISmcbXk-CW1Gj6Ab.js} +5 -5
- package/dist/index.js +199 -1760
- package/dist/{logger-DN-RT9jL.js → logger-DKw-DPXD.js} +3 -3
- package/dist/logger.js +1 -1
- package/dist/{mcp-DZXbfmbs.js → mcp-BRFYI5rd.js} +42 -50
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +7 -7
- package/dist/{pricing-fetcher-Dq-OLBp4.d.ts → pricing-fetcher-BkSZh4lR.d.ts} +83 -3
- package/dist/pricing-fetcher-BlxDpqFj.js +205 -0
- package/dist/pricing-fetcher.d.ts +2 -2
- package/dist/pricing-fetcher.js +3 -3
- package/dist/{sury-DmrZ3_Oj-l0qqtY-f.js → sury-DmrZ3_Oj-Cpjsc2Lm.js} +1 -1
- package/dist/utils.table-DRzF8vZJ.js +1838 -0
- package/dist/utils.table.d.ts +24 -0
- package/dist/utils.table.js +3 -0
- package/dist/valibot-CQk-M5rL-BcaCeUrF.js +10 -0
- package/dist/{zod-Db63SLXj-N1oN-yiY.js → zod-Db63SLXj-BIXn64AP.js} +3 -3
- package/package.json +2 -1
- package/dist/pricing-fetcher-DMNBE90M.js +0 -79
- package/dist/valibot-CQk-M5rL-BNHzwpA0.js +0 -10
- /package/dist/{arktype-C-GObzDh-Bx7Fdrqj.js → arktype-C-GObzDh-CNoBqQrr.js} +0 -0
- /package/dist/{core-B0ovMhJe.js → core-DHCbAXJf.js} +0 -0
- /package/dist/{dist-BEQ1tJCL.js → dist-DCvt9hEv.js} +0 -0
- /package/dist/{prompt-CUbwSrjo.js → prompt-DtZgx4wU.js} +0 -0
- /package/dist/{types-DS8M8QF_.js → types-BlyCnKwN.js} +0 -0
|
@@ -1,85 +1,11 @@
|
|
|
1
|
-
import { ArraySchema, InferOutput, NumberSchema, ObjectSchema, OptionalSchema, PricingFetcher, RegexAction, SchemaWithPipe, StringSchema } from "./pricing-fetcher-
|
|
1
|
+
import { ArraySchema, CostMode, InferOutput, NumberSchema, ObjectSchema, OptionalSchema, PricingFetcher, RegexAction, SchemaWithPipe, SortOrder, StringSchema } from "./pricing-fetcher-BkSZh4lR.js";
|
|
2
2
|
|
|
3
|
-
//#region
|
|
4
|
-
declare global {
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
|
|
6
|
-
interface SymbolConstructor {
|
|
7
|
-
readonly observable: symbol;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
3
|
+
//#region src/data-loader.d.ts
|
|
10
4
|
|
|
11
5
|
/**
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
@see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
|
|
16
|
-
@see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
|
|
17
|
-
@see https://github.com/benlesh/symbol-observable#making-an-object-observable
|
|
18
|
-
|
|
19
|
-
@category Observable
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
//#endregion
|
|
23
|
-
//#region node_modules/type-fest/source/tuple-to-union.d.ts
|
|
24
|
-
/**
|
|
25
|
-
Convert a tuple/array into a union type of its elements.
|
|
26
|
-
|
|
27
|
-
This can be useful when you have a fixed set of allowed values and want a type defining only the allowed values, but do not want to repeat yourself.
|
|
28
|
-
|
|
29
|
-
@example
|
|
30
|
-
```
|
|
31
|
-
import type {TupleToUnion} from 'type-fest';
|
|
32
|
-
|
|
33
|
-
const destinations = ['a', 'b', 'c'] as const;
|
|
34
|
-
|
|
35
|
-
type Destination = TupleToUnion<typeof destinations>;
|
|
36
|
-
//=> 'a' | 'b' | 'c'
|
|
37
|
-
|
|
38
|
-
function verifyDestination(destination: unknown): destination is Destination {
|
|
39
|
-
return destinations.includes(destination as any);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type RequestBody = {
|
|
43
|
-
deliverTo: Destination;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
function verifyRequestBody(body: unknown): body is RequestBody {
|
|
47
|
-
const deliverTo = (body as any).deliverTo;
|
|
48
|
-
return typeof body === 'object' && body !== null && verifyDestination(deliverTo);
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Alternatively, you may use `typeof destinations[number]`. If `destinations` is a tuple, there is no difference. However if `destinations` is a string, the resulting type will the union of the characters in the string. Other types of `destinations` may result in a compile error. In comparison, TupleToUnion will return `never` if a tuple is not provided.
|
|
53
|
-
|
|
54
|
-
@example
|
|
55
|
-
```
|
|
56
|
-
const destinations = ['a', 'b', 'c'] as const;
|
|
57
|
-
|
|
58
|
-
type Destination = typeof destinations[number];
|
|
59
|
-
//=> 'a' | 'b' | 'c'
|
|
60
|
-
|
|
61
|
-
const erroringType = new Set(['a', 'b', 'c']);
|
|
62
|
-
|
|
63
|
-
type ErroringType = typeof erroringType[number];
|
|
64
|
-
//=> Type 'Set<string>' has no matching index signature for type 'number'. ts(2537)
|
|
65
|
-
|
|
66
|
-
const numberBool: { [n: number]: boolean } = { 1: true };
|
|
67
|
-
|
|
68
|
-
type NumberBool = typeof numberBool[number];
|
|
69
|
-
//=> boolean
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
@category Array
|
|
73
|
-
*/
|
|
74
|
-
type TupleToUnion<ArrayType> = ArrayType extends readonly unknown[] ? ArrayType[number] : never;
|
|
75
|
-
//#endregion
|
|
76
|
-
//#region src/types.internal.d.ts
|
|
77
|
-
declare const CostModes: readonly ["auto", "calculate", "display"];
|
|
78
|
-
type CostMode = TupleToUnion<typeof CostModes>;
|
|
79
|
-
declare const SortOrders: readonly ["desc", "asc"];
|
|
80
|
-
type SortOrder = TupleToUnion<typeof SortOrders>;
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/data-loader.d.ts
|
|
6
|
+
* Default path for Claude data directory
|
|
7
|
+
* Uses environment variable CLAUDE_CONFIG_DIR if set, otherwise defaults to ~/.claude
|
|
8
|
+
*/
|
|
83
9
|
declare function getDefaultClaudePath(): string;
|
|
84
10
|
declare const UsageDataSchema: ObjectSchema<{
|
|
85
11
|
readonly timestamp: StringSchema<undefined>;
|
|
@@ -165,6 +91,7 @@ declare const MonthlyUsageSchema: ObjectSchema<{
|
|
|
165
91
|
}, undefined>;
|
|
166
92
|
type MonthlyUsage = InferOutput<typeof MonthlyUsageSchema>;
|
|
167
93
|
declare function formatDate(dateStr: string): string;
|
|
94
|
+
declare function formatDateCompact(dateStr: string): string;
|
|
168
95
|
/**
|
|
169
96
|
* Create a unique identifier for deduplication using message ID and request ID
|
|
170
97
|
*/
|
|
@@ -188,9 +115,10 @@ type LoadOptions = {
|
|
|
188
115
|
claudePath?: string;
|
|
189
116
|
mode?: CostMode;
|
|
190
117
|
order?: SortOrder;
|
|
118
|
+
offline?: boolean;
|
|
191
119
|
} & DateFilter;
|
|
192
120
|
declare function loadDailyUsageData(options?: LoadOptions): Promise<DailyUsage[]>;
|
|
193
121
|
declare function loadSessionData(options?: LoadOptions): Promise<SessionUsage[]>;
|
|
194
122
|
declare function loadMonthlyUsageData(options?: LoadOptions): Promise<MonthlyUsage[]>;
|
|
195
123
|
//#endregion
|
|
196
|
-
export { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, ModelBreakdown, ModelBreakdownSchema, MonthlyUsage, MonthlyUsageSchema, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
|
124
|
+
export { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, ModelBreakdown, ModelBreakdownSchema, MonthlyUsage, MonthlyUsageSchema, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
package/dist/data-loader.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "./
|
|
3
|
-
export { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, ModelBreakdown, ModelBreakdownSchema, MonthlyUsage, MonthlyUsageSchema, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
|
1
|
+
import "./pricing-fetcher-BkSZh4lR.js";
|
|
2
|
+
import { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, ModelBreakdown, ModelBreakdownSchema, MonthlyUsage, MonthlyUsageSchema, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp } from "./data-loader-OGaMjZTD.js";
|
|
3
|
+
export { DailyUsage, DailyUsageSchema, DateFilter, LoadOptions, ModelBreakdown, ModelBreakdownSchema, MonthlyUsage, MonthlyUsageSchema, SessionUsage, SessionUsageSchema, UsageData, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
package/dist/data-loader.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DailyUsageSchema, ModelBreakdownSchema, MonthlyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp } from "./data-loader-
|
|
2
|
-
import "./dist-
|
|
3
|
-
import "./logger-
|
|
4
|
-
import "./pricing-fetcher-
|
|
1
|
+
import { DailyUsageSchema, ModelBreakdownSchema, MonthlyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp } from "./data-loader-Ca8k_uX0.js";
|
|
2
|
+
import "./dist-DCvt9hEv.js";
|
|
3
|
+
import "./logger-DKw-DPXD.js";
|
|
4
|
+
import "./pricing-fetcher-BlxDpqFj.js";
|
|
5
5
|
|
|
6
|
-
export { DailyUsageSchema, ModelBreakdownSchema, MonthlyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
|
6
|
+
export { DailyUsageSchema, ModelBreakdownSchema, MonthlyUsageSchema, SessionUsageSchema, UsageDataSchema, calculateCostForEntry, createUniqueHash, formatDate, formatDateCompact, getDefaultClaudePath, getEarliestTimestamp, loadDailyUsageData, loadMonthlyUsageData, loadSessionData, sortFilesByTimestamp };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { __toESM } from "./chunk-BLXvPPr8.js";
|
|
2
|
+
import { UsageDataSchema, glob, require_usingCtx } from "./data-loader-Ca8k_uX0.js";
|
|
3
|
+
import { safeParse } from "./dist-DCvt9hEv.js";
|
|
4
|
+
import { logger } from "./logger-DKw-DPXD.js";
|
|
5
|
+
import { PricingFetcher } from "./pricing-fetcher-BlxDpqFj.js";
|
|
5
6
|
import { readFile } from "node:fs/promises";
|
|
6
7
|
import { homedir } from "node:os";
|
|
7
8
|
import path from "node:path";
|
package/dist/debug.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./data-loader-
|
|
2
|
-
import "./dist-
|
|
3
|
-
import "./logger-
|
|
4
|
-
import "./pricing-fetcher-
|
|
5
|
-
import { detectMismatches, printMismatchReport } from "./debug-
|
|
1
|
+
import "./data-loader-Ca8k_uX0.js";
|
|
2
|
+
import "./dist-DCvt9hEv.js";
|
|
3
|
+
import "./logger-DKw-DPXD.js";
|
|
4
|
+
import "./pricing-fetcher-BlxDpqFj.js";
|
|
5
|
+
import { detectMismatches, printMismatchReport } from "./debug-zCcXwR8p.js";
|
|
6
6
|
|
|
7
7
|
export { detectMismatches, printMismatchReport };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ZodFirstPartyTypeKind, ZodOptional } from "./types-
|
|
1
|
+
import { ZodFirstPartyTypeKind, ZodOptional } from "./types-BlyCnKwN.js";
|
|
2
2
|
|
|
3
3
|
//#region node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
4
4
|
const ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
@@ -9,11 +9,11 @@ const tryImport = async (result, name) => {
|
|
|
9
9
|
};
|
|
10
10
|
const getToJsonSchemaFn = async (vendor) => {
|
|
11
11
|
switch (vendor) {
|
|
12
|
-
case "arktype": return import("./arktype-C-GObzDh-
|
|
13
|
-
case "effect": return import("./effect-WSjEuzC9-
|
|
14
|
-
case "sury": return import("./sury-DmrZ3_Oj-
|
|
15
|
-
case "valibot": return import("./valibot-CQk-M5rL-
|
|
16
|
-
case "zod": return import("./zod-Db63SLXj-
|
|
12
|
+
case "arktype": return import("./arktype-C-GObzDh-CNoBqQrr.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
13
|
+
case "effect": return import("./effect-WSjEuzC9-DHMVzzyB.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
14
|
+
case "sury": return import("./sury-DmrZ3_Oj-Cpjsc2Lm.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
15
|
+
case "valibot": return import("./valibot-CQk-M5rL-BcaCeUrF.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
16
|
+
case "zod": return import("./zod-Db63SLXj-BIXn64AP.js").then(async ({ getToJsonSchemaFn: getToJsonSchemaFn2 }) => getToJsonSchemaFn2());
|
|
17
17
|
default: throw new Error(`xsschema: Unsupported schema vendor "${vendor}". see https://xsai.js.org/docs/packages-top/xsschema#unsupported-schema-vendor`);
|
|
18
18
|
}
|
|
19
19
|
};
|