ccusage 0.6.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.
Files changed (43) hide show
  1. package/README.md +27 -19
  2. package/dist/calculate-cost.d.ts +11 -8
  3. package/dist/{core-BgFXUe_h.js → core-B0ovMhJe.js} +4 -4
  4. package/dist/{data-loader-CDv0IYZx.js → data-loader-DP5qBPn6.js} +112 -92
  5. package/dist/{data-loader-aUOjeZ06.d.ts → data-loader-VdEcqJHc.d.ts} +15 -11
  6. package/dist/data-loader.d.ts +2 -4
  7. package/dist/data-loader.js +4 -4
  8. package/dist/{debug-Dk36WQTw.js → debug-C_5Qx11m.js} +13 -13
  9. package/dist/debug.d.ts +4 -4
  10. package/dist/debug.js +5 -5
  11. package/dist/{dist-FwNhpFrW.js → dist-C0-Tf5eD.js} +1 -92
  12. package/dist/{dist-C_i5I27w.js → dist-LwbOR2Yw.js} +5 -5
  13. package/dist/{effect-WSjEuzC9-BsxP11fz.js → effect-WSjEuzC9-CJfWUy0j.js} +1 -1
  14. package/dist/{esm-vjyZjnpZ.js → esm-Dqsc1zmX.js} +1 -1
  15. package/dist/{index-CISmcbXk-BotItq1T.js → index-CISmcbXk-DCA05NUL.js} +5 -5
  16. package/dist/index.js +117 -42
  17. package/dist/{logger-DhDyJEC5.js → logger-DsQC4OvA.js} +17 -17
  18. package/dist/logger.js +1 -1
  19. package/dist/{mcp-G-TIOcuj.js → mcp-BQdv12mr.js} +82 -73
  20. package/dist/mcp.d.ts +2 -4
  21. package/dist/mcp.js +7 -8
  22. package/dist/{pricing-fetcher-BCv1Vods.js → pricing-fetcher-BPUgMrB_.js} +9 -9
  23. package/dist/{index-BurjgCfW.d.ts → pricing-fetcher-CfEgfzSr.d.ts} +19 -249
  24. package/dist/pricing-fetcher.d.ts +1 -2
  25. package/dist/pricing-fetcher.js +3 -3
  26. package/dist/{prompt-IToGuko2.js → prompt-DljZqwMa.js} +4 -4
  27. package/dist/{sury-DmrZ3_Oj-DhGOjCNc.js → sury-DmrZ3_Oj-CCL_DlTt.js} +1 -1
  28. package/dist/{types-CFnCBr2I.js → types-DS8M8QF_.js} +4 -4
  29. package/dist/{valibot-CQk-M5rL-Cq5E7F3g.js → valibot-CQk-M5rL-CkjrLVu1.js} +2 -2
  30. package/dist/{zod-Db63SLXj-BWdcigdx.js → zod-Db63SLXj-Dyc_OWjq.js} +3 -3
  31. package/package.json +8 -11
  32. package/dist/pricing-fetcher-DygIroMj.d.ts +0 -21
  33. package/dist/shared-args-BtMSktLn.js +0 -68
  34. package/dist/shared-args.d.ts +0 -108
  35. package/dist/shared-args.js +0 -8
  36. package/dist/types-BcXIBMQk.js +0 -42
  37. package/dist/types-y1JQzaKZ.d.ts +0 -81
  38. package/dist/types.d.ts +0 -3
  39. package/dist/types.js +0 -4
  40. package/dist/utils-C7kg8MXN.js +0 -10
  41. package/dist/utils.d.ts +0 -5
  42. package/dist/utils.js +0 -3
  43. /package/dist/{arktype-C-GObzDh-Dj1DVoqC.js → arktype-C-GObzDh-Bx7Fdrqj.js} +0 -0
@@ -994,63 +994,6 @@ declare function array<const TItem extends BaseSchema<unknown, unknown, BaseIssu
994
994
  * Array schema interface.
995
995
  */
996
996
 
997
- /**
998
- * Boolean issue interface.
999
- */
1000
- interface BooleanIssue extends BaseIssue<unknown> {
1001
- /**
1002
- * The issue kind.
1003
- */
1004
- readonly kind: 'schema';
1005
- /**
1006
- * The issue type.
1007
- */
1008
- readonly type: 'boolean';
1009
- /**
1010
- * The expected property.
1011
- */
1012
- readonly expected: 'boolean';
1013
- }
1014
- /**
1015
- * Boolean schema interface.
1016
- */
1017
- interface BooleanSchema<TMessage extends ErrorMessage<BooleanIssue> | undefined> extends BaseSchema<boolean, boolean, BooleanIssue> {
1018
- /**
1019
- * The schema type.
1020
- */
1021
- readonly type: 'boolean';
1022
- /**
1023
- * The schema reference.
1024
- */
1025
- readonly reference: typeof boolean;
1026
- /**
1027
- * The expected property.
1028
- */
1029
- readonly expects: 'boolean';
1030
- /**
1031
- * The error message.
1032
- */
1033
- readonly message: TMessage;
1034
- }
1035
- /**
1036
- * Creates a boolean schema.
1037
- *
1038
- * @returns A boolean schema.
1039
- */
1040
- declare function boolean(): BooleanSchema<undefined>;
1041
- /**
1042
- * Creates a boolean schema.
1043
- *
1044
- * @param message The error message.
1045
- *
1046
- * @returns A boolean schema.
1047
- */
1048
- declare function boolean<const TMessage extends ErrorMessage<BooleanIssue> | undefined>(message: TMessage): BooleanSchema<TMessage>;
1049
-
1050
- /**
1051
- * Custom issue interface.
1052
- */
1053
-
1054
997
  /**
1055
998
  * Exact optional schema interface.
1056
999
  */
@@ -1141,75 +1084,6 @@ declare function exactOptionalAsync<const TWrapped extends BaseSchema<unknown, u
1141
1084
  * File issue interface.
1142
1085
  */
1143
1086
 
1144
- /**
1145
- * Union issue interface.
1146
- */
1147
- interface UnionIssue<TSubIssue extends BaseIssue<unknown>> extends BaseIssue<unknown> {
1148
- /**
1149
- * The issue kind.
1150
- */
1151
- readonly kind: 'schema';
1152
- /**
1153
- * The issue type.
1154
- */
1155
- readonly type: 'union';
1156
- /**
1157
- * The expected property.
1158
- */
1159
- readonly expected: string;
1160
- /**
1161
- * The sub issues.
1162
- */
1163
- readonly issues?: [TSubIssue, ...TSubIssue[]];
1164
- }
1165
-
1166
- /**
1167
- * Union options type.
1168
- */
1169
- type UnionOptions = MaybeReadonly<BaseSchema<unknown, unknown, BaseIssue<unknown>>[]>;
1170
- /**
1171
- * Union schema interface.
1172
- */
1173
- interface UnionSchema<TOptions extends UnionOptions, TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined> extends BaseSchema<InferInput<TOptions[number]>, InferOutput<TOptions[number]>, UnionIssue<InferIssue<TOptions[number]>> | InferIssue<TOptions[number]>> {
1174
- /**
1175
- * The schema type.
1176
- */
1177
- readonly type: 'union';
1178
- /**
1179
- * The schema reference.
1180
- */
1181
- readonly reference: typeof union;
1182
- /**
1183
- * The union options.
1184
- */
1185
- readonly options: TOptions;
1186
- /**
1187
- * The error message.
1188
- */
1189
- readonly message: TMessage;
1190
- }
1191
- /**
1192
- * Creates an union schema.
1193
- *
1194
- * @param options The union options.
1195
- *
1196
- * @returns An union schema.
1197
- */
1198
- declare function union<const TOptions extends UnionOptions>(options: TOptions): UnionSchema<TOptions, undefined>;
1199
- /**
1200
- * Creates an union schema.
1201
- *
1202
- * @param options The union options.
1203
- * @param message The error message.
1204
- *
1205
- * @returns An union schema.
1206
- */
1207
- declare function union<const TOptions extends UnionOptions, const TMessage extends ErrorMessage<UnionIssue<InferIssue<TOptions[number]>>> | undefined>(options: TOptions, message: TMessage): UnionSchema<TOptions, TMessage>;
1208
-
1209
- /**
1210
- * Union options async type.
1211
- */
1212
-
1213
1087
  /**
1214
1088
  * Infer nullish output type.
1215
1089
  */
@@ -1524,110 +1398,6 @@ declare function optionalAsync<const TWrapped extends BaseSchema<unknown, unknow
1524
1398
  * Picklist options type.
1525
1399
  */
1526
1400
 
1527
- /**
1528
- * Record issue interface.
1529
- */
1530
- interface RecordIssue extends BaseIssue<unknown> {
1531
- /**
1532
- * The issue kind.
1533
- */
1534
- readonly kind: 'schema';
1535
- /**
1536
- * The issue type.
1537
- */
1538
- readonly type: 'record';
1539
- /**
1540
- * The expected property.
1541
- */
1542
- readonly expected: 'Object';
1543
- }
1544
- /**
1545
- * Is literal type.
1546
- */
1547
- type IsLiteral<TKey extends string | number | symbol> = string extends TKey ? false : number extends TKey ? false : symbol extends TKey ? false : TKey extends Brand<string | number | symbol> ? false : true;
1548
- /**
1549
- * Optional keys type.
1550
- */
1551
- type OptionalKeys<TObject extends Record<string | number | symbol, unknown>> = { [TKey in keyof TObject]: IsLiteral<TKey> extends true ? TKey : never }[keyof TObject];
1552
- /**
1553
- * With question marks type.
1554
- *
1555
- * Hint: We mark an entry as optional if we detect that its key is a literal
1556
- * type. The reason for this is that it is not technically possible to detect
1557
- * missing literal keys without restricting the key schema to `string`, `enum`
1558
- * and `picklist`. However, if `enum` and `picklist` are used, it is better to
1559
- * use `object` with `entriesFromList` because it already covers the needed
1560
- * functionality. This decision also reduces the bundle size of `record`,
1561
- * because it only needs to check the entries of the input and not any missing
1562
- * keys.
1563
- */
1564
- type WithQuestionMarks<TObject extends Record<string | number | symbol, unknown>> = MarkOptional<TObject, OptionalKeys<TObject>>;
1565
- /**
1566
- * With readonly type.
1567
- */
1568
- type WithReadonly<TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>, TObject extends WithQuestionMarks<Record<string | number | symbol, unknown>>> = TValue extends SchemaWithPipe<infer TPipe> | SchemaWithPipeAsync<infer TPipe> ? ReadonlyAction<any> extends TPipe[number] ? Readonly<TObject> : TObject : TObject;
1569
- /**
1570
- * Infer record input type.
1571
- */
1572
- type InferRecordInput<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>> | BaseSchemaAsync<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = Prettify<WithQuestionMarks<Record<InferInput<TKey>, InferInput<TValue>>>>;
1573
- /**
1574
- * Infer record output type.
1575
- */
1576
- type InferRecordOutput<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>> | BaseSchemaAsync<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>> | BaseSchemaAsync<unknown, unknown, BaseIssue<unknown>>> = Prettify<WithReadonly<TValue, WithQuestionMarks<Record<InferOutput<TKey>, InferOutput<TValue>>>>>;
1577
-
1578
- /**
1579
- * Record schema interface.
1580
- */
1581
- interface RecordSchema<TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, TMessage extends ErrorMessage<RecordIssue> | undefined> extends BaseSchema<InferRecordInput<TKey, TValue>, InferRecordOutput<TKey, TValue>, RecordIssue | InferIssue<TKey> | InferIssue<TValue>> {
1582
- /**
1583
- * The schema type.
1584
- */
1585
- readonly type: 'record';
1586
- /**
1587
- * The schema reference.
1588
- */
1589
- readonly reference: typeof record;
1590
- /**
1591
- * The expected property.
1592
- */
1593
- readonly expects: 'Object';
1594
- /**
1595
- * The record key schema.
1596
- */
1597
- readonly key: TKey;
1598
- /**
1599
- * The record value schema.
1600
- */
1601
- readonly value: TValue;
1602
- /**
1603
- * The error message.
1604
- */
1605
- readonly message: TMessage;
1606
- }
1607
- /**
1608
- * Creates a record schema.
1609
- *
1610
- * @param key The key schema.
1611
- * @param value The value schema.
1612
- *
1613
- * @returns A record schema.
1614
- */
1615
- declare function record<const TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, const TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>>(key: TKey, value: TValue): RecordSchema<TKey, TValue, undefined>;
1616
- /**
1617
- * Creates a record schema.
1618
- *
1619
- * @param key The key schema.
1620
- * @param value The value schema.
1621
- * @param message The error message.
1622
- *
1623
- * @returns A record schema.
1624
- */
1625
- declare function record<const TKey extends BaseSchema<string, string | number | symbol, BaseIssue<unknown>>, const TValue extends BaseSchema<unknown, unknown, BaseIssue<unknown>>, const TMessage extends ErrorMessage<RecordIssue> | undefined>(key: TKey, value: TValue, message: TMessage): RecordSchema<TKey, TValue, TMessage>;
1626
-
1627
- /**
1628
- * Record schema async interface.
1629
- */
1630
-
1631
1401
  /**
1632
1402
  * String issue interface.
1633
1403
  */
@@ -1685,24 +1455,6 @@ declare function string<const TMessage extends ErrorMessage<StringIssue> | undef
1685
1455
  * Symbol issue interface.
1686
1456
  */
1687
1457
 
1688
- /**
1689
- * Brand symbol.
1690
- */
1691
- declare const BrandSymbol: unique symbol;
1692
- /**
1693
- * Brand name type.
1694
- */
1695
- type BrandName = string | number | symbol;
1696
- /**
1697
- * Brand interface.
1698
- */
1699
- interface Brand<TName extends BrandName> {
1700
- [BrandSymbol]: { [TValue in TName]: TValue };
1701
- }
1702
- /**
1703
- * Brand action interface.
1704
- */
1705
-
1706
1458
  /**
1707
1459
  * Readonly output type.
1708
1460
  */
@@ -1807,4 +1559,22 @@ declare function regex<TInput extends string, const TMessage extends ErrorMessag
1807
1559
  * Returns action type.
1808
1560
  */
1809
1561
  //#endregion
1810
- export { ArraySchema, BooleanSchema, InferOutput, NumberSchema, ObjectSchema, OptionalSchema, RecordSchema, RegexAction, SchemaWithPipe, StringSchema, UnionSchema };
1562
+ //#region src/pricing-fetcher.d.ts
1563
+ declare const ModelPricingSchema: ObjectSchema<{
1564
+ readonly input_cost_per_token: OptionalSchema<NumberSchema<undefined>, undefined>;
1565
+ readonly output_cost_per_token: OptionalSchema<NumberSchema<undefined>, undefined>;
1566
+ readonly cache_creation_input_token_cost: OptionalSchema<NumberSchema<undefined>, undefined>;
1567
+ readonly cache_read_input_token_cost: OptionalSchema<NumberSchema<undefined>, undefined>;
1568
+ }, undefined>;
1569
+ type ModelPricing = InferOutput<typeof ModelPricingSchema>;
1570
+ declare function clearPricingCache(): void;
1571
+ declare function fetchModelPricing(): Promise<Record<string, ModelPricing>>;
1572
+ declare function getModelPricing(modelName: string, pricing: Record<string, ModelPricing>): ModelPricing | null;
1573
+ declare function calculateCostFromTokens(tokens: {
1574
+ input_tokens: number;
1575
+ output_tokens: number;
1576
+ cache_creation_input_tokens?: number;
1577
+ cache_read_input_tokens?: number;
1578
+ }, pricing: ModelPricing): number;
1579
+ //#endregion
1580
+ export { ArraySchema, InferOutput, ModelPricing, NumberSchema, ObjectSchema, OptionalSchema, RegexAction, SchemaWithPipe, StringSchema, calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing };
@@ -1,3 +1,2 @@
1
- import "./index-BurjgCfW.js";
2
- import { ModelPricing, calculateCostFromTokens$1 as calculateCostFromTokens, clearPricingCache$1 as clearPricingCache, fetchModelPricing$1 as fetchModelPricing, getModelPricing$1 as getModelPricing } from "./pricing-fetcher-DygIroMj.js";
1
+ import { ModelPricing, calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing } from "./pricing-fetcher-CfEgfzSr.js";
3
2
  export { ModelPricing, calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing };
@@ -1,5 +1,5 @@
1
- import "./dist-FwNhpFrW.js";
2
- import "./logger-DhDyJEC5.js";
3
- import { calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing } from "./pricing-fetcher-BCv1Vods.js";
1
+ import "./dist-C0-Tf5eD.js";
2
+ import "./logger-DsQC4OvA.js";
3
+ import { calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing } from "./pricing-fetcher-BPUgMrB_.js";
4
4
 
5
5
  export { calculateCostFromTokens, clearPricingCache, fetchModelPricing, getModelPricing };
@@ -1,4 +1,4 @@
1
- import process$1, { stdin, stdout } from "node:process";
1
+ import g$1, { stdin, stdout } from "node:process";
2
2
  import { WriteStream } from "node:tty";
3
3
  import f from "node:readline";
4
4
 
@@ -265,7 +265,7 @@ Object.keys(r.modifier);
265
265
  const tD = Object.keys(r.color), eD = Object.keys(r.bgColor);
266
266
  [...tD, ...eD];
267
267
  function sD() {
268
- const t = new Map();
268
+ const t = /* @__PURE__ */ new Map();
269
269
  for (const [u$1, F$1] of Object.entries(r)) {
270
270
  for (const [e$1, s] of Object.entries(F$1)) r[e$1] = {
271
271
  open: `\x1B[${s[0]}m`,
@@ -448,7 +448,7 @@ var AD = Object.defineProperty, pD = (t, u$1, F$1) => u$1 in t ? AD(t, u$1, {
448
448
  }) : t[u$1] = F$1, h = (t, u$1, F$1) => (pD(t, typeof u$1 != "symbol" ? u$1 + "" : u$1, F$1), F$1);
449
449
  var x = class {
450
450
  constructor(u$1, F$1 = true) {
451
- h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
451
+ h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", /* @__PURE__ */ new Map()), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
452
452
  const { input: e$1 = stdin, output: s = stdout, render: i, signal: D,...C$1 } = u$1;
453
453
  this.opts = C$1, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = F$1, this._abortSignal = D, this.input = e$1, this.output = s;
454
454
  }
@@ -650,7 +650,7 @@ var PD = class extends x {
650
650
  }
651
651
  };
652
652
  function ce() {
653
- return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
653
+ return g$1.platform !== "win32" ? g$1.env.TERM !== "linux" : !!g$1.env.CI || !!g$1.env.WT_SESSION || !!g$1.env.TERMINUS_SUBLIME || g$1.env.ConEmuTask === "{cmd::Cmder}" || g$1.env.TERM_PROGRAM === "Terminus-Sublime" || g$1.env.TERM_PROGRAM === "vscode" || g$1.env.TERM === "xterm-256color" || g$1.env.TERM === "alacritty" || g$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
654
654
  }
655
655
  const V = ce(), u = (t, n) => V ? t : n, le = u("❯", ">"), L = u("■", "x"), W = u("▲", "x"), C = u("✔", "√"), o = u(""), d = u(""), k = u("●", ">"), P = u("○", " "), A = u("◻", "[•]"), T = u("◼", "[+]"), F = u("◻", "[ ]"), w = (t) => {
656
656
  switch (t) {
@@ -1,4 +1,4 @@
1
- import { tryImport } from "./index-CISmcbXk-BotItq1T.js";
1
+ import { tryImport } from "./index-CISmcbXk-DCA05NUL.js";
2
2
 
3
3
  //#region node_modules/xsschema/dist/sury-DmrZ3_Oj.js
4
4
  const getToJsonSchemaFn = async () => {
@@ -2511,7 +2511,7 @@ var ZodDiscriminatedUnion = class ZodDiscriminatedUnion extends ZodType {
2511
2511
  * @param params
2512
2512
  */
2513
2513
  static create(discriminator, options, params) {
2514
- const optionsMap = new Map();
2514
+ const optionsMap = /* @__PURE__ */ new Map();
2515
2515
  for (const type of options) {
2516
2516
  const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2517
2517
  if (!discriminatorValues.length) throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
@@ -2749,7 +2749,7 @@ var ZodMap = class extends ZodType {
2749
2749
  };
2750
2750
  });
2751
2751
  if (ctx.common.async) {
2752
- const finalMap = new Map();
2752
+ const finalMap = /* @__PURE__ */ new Map();
2753
2753
  return Promise.resolve().then(async () => {
2754
2754
  for (const pair of pairs) {
2755
2755
  const key = await pair.key;
@@ -2764,7 +2764,7 @@ var ZodMap = class extends ZodType {
2764
2764
  };
2765
2765
  });
2766
2766
  } else {
2767
- const finalMap = new Map();
2767
+ const finalMap = /* @__PURE__ */ new Map();
2768
2768
  for (const pair of pairs) {
2769
2769
  const key = pair.key;
2770
2770
  const value = pair.value;
@@ -2827,7 +2827,7 @@ var ZodSet = class ZodSet extends ZodType {
2827
2827
  }
2828
2828
  const valueType = this._def.valueType;
2829
2829
  function finalizeSet(elements$1) {
2830
- const parsedSet = new Set();
2830
+ const parsedSet = /* @__PURE__ */ new Set();
2831
2831
  for (const element of elements$1) {
2832
2832
  if (element.status === "aborted") return INVALID;
2833
2833
  if (element.status === "dirty") status.dirty();
@@ -1,8 +1,8 @@
1
- import { tryImport } from "./index-CISmcbXk-BotItq1T.js";
1
+ import { tryImport } from "./index-CISmcbXk-DCA05NUL.js";
2
2
 
3
3
  //#region node_modules/xsschema/dist/valibot-CQk-M5rL.js
4
4
  const getToJsonSchemaFn = async () => {
5
- const { toJsonSchema } = await tryImport(import("./dist-C_i5I27w.js"), "@valibot/to-json-schema");
5
+ const { toJsonSchema } = await tryImport(import("./dist-LwbOR2Yw.js"), "@valibot/to-json-schema");
6
6
  return (schema) => toJsonSchema(schema);
7
7
  };
8
8
 
@@ -1,4 +1,4 @@
1
- import { missingDependenciesUrl } from "./index-CISmcbXk-BotItq1T.js";
1
+ import { missingDependenciesUrl } from "./index-CISmcbXk-DCA05NUL.js";
2
2
 
3
3
  //#region node_modules/xsschema/dist/zod-Db63SLXj.js
4
4
  const getToJsonSchemaFn = async () => {
@@ -9,13 +9,13 @@ const getToJsonSchemaFn = async () => {
9
9
  throw new Error(`xsschema: Missing zod v3 dependencies "zod-to-json-schema". see ${missingDependenciesUrl}`);
10
10
  };
11
11
  try {
12
- const { toJSONSchema } = await import("./core-BgFXUe_h.js");
12
+ const { toJSONSchema } = await import("./core-B0ovMhJe.js");
13
13
  zodV4toJSONSchema = toJSONSchema;
14
14
  } catch (err) {
15
15
  if (err instanceof Error) console.error(err.message);
16
16
  }
17
17
  try {
18
- const { zodToJsonSchema } = await import("./esm-vjyZjnpZ.js");
18
+ const { zodToJsonSchema } = await import("./esm-Dqsc1zmX.js");
19
19
  zodV3ToJSONSchema = zodToJsonSchema;
20
20
  } catch (err) {
21
21
  if (err instanceof Error) console.error(err.message);
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "ccusage",
3
- "version": "0.6.0",
3
+ "type": "module",
4
+ "version": "0.6.1",
4
5
  "description": "Usage analysis tool for Claude Code",
6
+ "author": "ryoppippi",
7
+ "license": "MIT",
8
+ "funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
5
9
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
- "bugs": {
7
- "url": "https://github.com/ryoppippi/ccusage/issues"
8
- },
9
10
  "repository": {
10
11
  "type": "git",
11
12
  "url": "git+https://github.com/ryoppippi/ccusage.git"
12
13
  },
13
- "funding": "https://github.com/ryoppippi/ccusage?sponsor=1",
14
- "license": "MIT",
15
- "author": "ryoppippi",
16
- "type": "module",
14
+ "bugs": {
15
+ "url": "https://github.com/ryoppippi/ccusage/issues"
16
+ },
17
17
  "exports": {
18
18
  ".": "./dist/index.js",
19
19
  "./calculate-cost": "./dist/calculate-cost.js",
@@ -22,9 +22,6 @@
22
22
  "./logger": "./dist/logger.js",
23
23
  "./mcp": "./dist/mcp.js",
24
24
  "./pricing-fetcher": "./dist/pricing-fetcher.js",
25
- "./shared-args": "./dist/shared-args.js",
26
- "./types": "./dist/types.js",
27
- "./utils": "./dist/utils.js",
28
25
  "./package.json": "./package.json"
29
26
  },
30
27
  "main": "./dist/index.js",
@@ -1,21 +0,0 @@
1
- import { InferOutput, NumberSchema, ObjectSchema, OptionalSchema } from "./index-BurjgCfW.js";
2
-
3
- //#region src/pricing-fetcher.d.ts
4
- declare const ModelPricingSchema: ObjectSchema<{
5
- readonly input_cost_per_token: OptionalSchema<NumberSchema<undefined>, undefined>;
6
- readonly output_cost_per_token: OptionalSchema<NumberSchema<undefined>, undefined>;
7
- readonly cache_creation_input_token_cost: OptionalSchema<NumberSchema<undefined>, undefined>;
8
- readonly cache_read_input_token_cost: OptionalSchema<NumberSchema<undefined>, undefined>;
9
- }, undefined>;
10
- type ModelPricing = InferOutput<typeof ModelPricingSchema>;
11
- declare function clearPricingCache(): void;
12
- declare function fetchModelPricing(): Promise<Record<string, ModelPricing>>;
13
- declare function getModelPricing(modelName: string, pricing: Record<string, ModelPricing>): ModelPricing | null;
14
- declare function calculateCostFromTokens(tokens: {
15
- input_tokens: number;
16
- output_tokens: number;
17
- cache_creation_input_tokens?: number;
18
- cache_read_input_tokens?: number;
19
- }, pricing: ModelPricing): number;
20
- //#endregion
21
- export { ModelPricing, calculateCostFromTokens as calculateCostFromTokens$1, clearPricingCache as clearPricingCache$1, fetchModelPricing as fetchModelPricing$1, getModelPricing as getModelPricing$1 };
@@ -1,68 +0,0 @@
1
- import { getDefaultClaudePath } from "./data-loader-CDv0IYZx.js";
2
- import { safeParse } from "./dist-FwNhpFrW.js";
3
- import { CostModes, SortOrders, dateSchema } from "./types-BcXIBMQk.js";
4
-
5
- //#region src/shared-args.ts
6
- const parseDateArg = (value) => {
7
- const result = safeParse(dateSchema, value);
8
- if (!result.success) throw new TypeError(result.issues[0].message);
9
- return result.output;
10
- };
11
- const sharedArgs = {
12
- since: {
13
- type: "custom",
14
- short: "s",
15
- description: "Filter from date (YYYYMMDD format)",
16
- parse: parseDateArg
17
- },
18
- until: {
19
- type: "custom",
20
- short: "u",
21
- description: "Filter until date (YYYYMMDD format)",
22
- parse: parseDateArg
23
- },
24
- path: {
25
- type: "string",
26
- short: "p",
27
- description: "Custom path to Claude data directory",
28
- default: getDefaultClaudePath()
29
- },
30
- json: {
31
- type: "boolean",
32
- short: "j",
33
- description: "Output in JSON format",
34
- default: false
35
- },
36
- mode: {
37
- type: "enum",
38
- short: "m",
39
- description: "Cost calculation mode: auto (use costUSD if exists, otherwise calculate), calculate (always calculate), display (always use costUSD)",
40
- default: "auto",
41
- choices: CostModes
42
- },
43
- debug: {
44
- type: "boolean",
45
- short: "d",
46
- description: "Show pricing mismatch information for debugging",
47
- default: false
48
- },
49
- debugSamples: {
50
- type: "number",
51
- description: "Number of sample discrepancies to show in debug output (default: 5)",
52
- default: 5
53
- },
54
- order: {
55
- type: "enum",
56
- short: "o",
57
- description: "Sort order: desc (newest first) or asc (oldest first)",
58
- default: "asc",
59
- choices: SortOrders
60
- }
61
- };
62
- const sharedCommandConfig = {
63
- args: sharedArgs,
64
- toKebab: true
65
- };
66
-
67
- //#endregion
68
- export { sharedArgs, sharedCommandConfig };
@@ -1,108 +0,0 @@
1
- //#region src/shared-args.d.ts
2
- declare const sharedArgs: {
3
- readonly since: {
4
- readonly type: "custom";
5
- readonly short: "s";
6
- readonly description: "Filter from date (YYYYMMDD format)";
7
- readonly parse: (value: string) => string;
8
- };
9
- readonly until: {
10
- readonly type: "custom";
11
- readonly short: "u";
12
- readonly description: "Filter until date (YYYYMMDD format)";
13
- readonly parse: (value: string) => string;
14
- };
15
- readonly path: {
16
- readonly type: "string";
17
- readonly short: "p";
18
- readonly description: "Custom path to Claude data directory";
19
- readonly default: string;
20
- };
21
- readonly json: {
22
- readonly type: "boolean";
23
- readonly short: "j";
24
- readonly description: "Output in JSON format";
25
- readonly default: false;
26
- };
27
- readonly mode: {
28
- readonly type: "enum";
29
- readonly short: "m";
30
- readonly description: "Cost calculation mode: auto (use costUSD if exists, otherwise calculate), calculate (always calculate), display (always use costUSD)";
31
- readonly default: "auto";
32
- readonly choices: readonly ["auto", "calculate", "display"];
33
- };
34
- readonly debug: {
35
- readonly type: "boolean";
36
- readonly short: "d";
37
- readonly description: "Show pricing mismatch information for debugging";
38
- readonly default: false;
39
- };
40
- readonly debugSamples: {
41
- readonly type: "number";
42
- readonly description: "Number of sample discrepancies to show in debug output (default: 5)";
43
- readonly default: 5;
44
- };
45
- readonly order: {
46
- readonly type: "enum";
47
- readonly short: "o";
48
- readonly description: "Sort order: desc (newest first) or asc (oldest first)";
49
- readonly default: "asc";
50
- readonly choices: readonly ["desc", "asc"];
51
- };
52
- };
53
- declare const sharedCommandConfig: {
54
- readonly args: {
55
- readonly since: {
56
- readonly type: "custom";
57
- readonly short: "s";
58
- readonly description: "Filter from date (YYYYMMDD format)";
59
- readonly parse: (value: string) => string;
60
- };
61
- readonly until: {
62
- readonly type: "custom";
63
- readonly short: "u";
64
- readonly description: "Filter until date (YYYYMMDD format)";
65
- readonly parse: (value: string) => string;
66
- };
67
- readonly path: {
68
- readonly type: "string";
69
- readonly short: "p";
70
- readonly description: "Custom path to Claude data directory";
71
- readonly default: string;
72
- };
73
- readonly json: {
74
- readonly type: "boolean";
75
- readonly short: "j";
76
- readonly description: "Output in JSON format";
77
- readonly default: false;
78
- };
79
- readonly mode: {
80
- readonly type: "enum";
81
- readonly short: "m";
82
- readonly description: "Cost calculation mode: auto (use costUSD if exists, otherwise calculate), calculate (always calculate), display (always use costUSD)";
83
- readonly default: "auto";
84
- readonly choices: readonly ["auto", "calculate", "display"];
85
- };
86
- readonly debug: {
87
- readonly type: "boolean";
88
- readonly short: "d";
89
- readonly description: "Show pricing mismatch information for debugging";
90
- readonly default: false;
91
- };
92
- readonly debugSamples: {
93
- readonly type: "number";
94
- readonly description: "Number of sample discrepancies to show in debug output (default: 5)";
95
- readonly default: 5;
96
- };
97
- readonly order: {
98
- readonly type: "enum";
99
- readonly short: "o";
100
- readonly description: "Sort order: desc (newest first) or asc (oldest first)";
101
- readonly default: "asc";
102
- readonly choices: readonly ["desc", "asc"];
103
- };
104
- };
105
- readonly toKebab: true;
106
- };
107
- //#endregion
108
- export { sharedArgs, sharedCommandConfig };
@@ -1,8 +0,0 @@
1
- import "./data-loader-CDv0IYZx.js";
2
- import "./dist-FwNhpFrW.js";
3
- import "./logger-DhDyJEC5.js";
4
- import "./pricing-fetcher-BCv1Vods.js";
5
- import "./types-BcXIBMQk.js";
6
- import { sharedArgs, sharedCommandConfig } from "./shared-args-BtMSktLn.js";
7
-
8
- export { sharedArgs, sharedCommandConfig };