@ccusage/codex 17.1.2 → 17.1.4

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/index.js CHANGED
@@ -219,8 +219,7 @@ async function createCommandContext({ args, values, positionals, rest, argv: arg
219
219
  translate
220
220
  }));
221
221
  const defaultCommandResource = Object.entries(args).map(([key, arg]) => {
222
- const description$1 = arg.description || "";
223
- return [key, description$1];
222
+ return [key, arg.description || ""];
224
223
  }).reduce((res, [key, value]) => {
225
224
  res[resolveArgKey(key)] = value;
226
225
  return res;
@@ -744,8 +743,7 @@ function parse$2(token, option, schema) {
744
743
  }
745
744
  }
746
745
  function createRequireError(option, schema) {
747
- const message = schema.type === "positional" ? `Positional argument '${option}' is required` : `Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}is required`;
748
- return new ArgResolveError(message, option, "required", schema);
746
+ return new ArgResolveError(schema.type === "positional" ? `Positional argument '${option}' is required` : `Optional argument '--${option}' ${schema.short ? `or '-${schema.short}' ` : ""}is required`, option, "required", schema);
749
747
  }
750
748
  var ArgResolveError = class extends Error {
751
749
  name;
@@ -897,7 +895,7 @@ async function executeCommand(cmd, ctx, name$1) {
897
895
  await resolved.run(ctx);
898
896
  }
899
897
  var name = "@ccusage/codex";
900
- var version = "17.1.2";
898
+ var version = "17.1.4";
901
899
  var description = "Usage analysis tool for OpenAI Codex sessions";
902
900
  var require_debug = /* @__PURE__ */ __commonJSMin(((exports, module) => {
903
901
  let messages = [];
@@ -990,8 +988,7 @@ var require_utils$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
990
988
  break;
991
989
  case "center": {
992
990
  let right = Math.ceil(padlen / 2);
993
- let left = padlen - right;
994
- str = repeat(pad$1, left) + str + repeat(pad$1, right);
991
+ str = repeat(pad$1, padlen - right) + str + repeat(pad$1, right);
995
992
  break;
996
993
  }
997
994
  default:
@@ -1369,8 +1366,7 @@ var require_supports_colors = /* @__PURE__ */ __commonJSMin(((exports, module) =
1369
1366
  return min;
1370
1367
  }
1371
1368
  function getSupportLevel(stream) {
1372
- var level$1 = supportsColor(stream);
1373
- return translateLevel(level$1);
1369
+ return translateLevel(supportsColor(stream));
1374
1370
  }
1375
1371
  module.exports = {
1376
1372
  supportsColor: getSupportLevel,
@@ -2181,13 +2177,12 @@ var require_layout_manager = /* @__PURE__ */ __commonJSMin(((exports, module) =>
2181
2177
  let yMin1 = cell1.y;
2182
2178
  let yMax1 = cell1.y - 1 + (cell1.rowSpan || 1);
2183
2179
  let yMin2 = cell2.y;
2184
- let yMax2 = cell2.y - 1 + (cell2.rowSpan || 1);
2185
- let yConflict = !(yMin1 > yMax2 || yMin2 > yMax1);
2180
+ let yConflict = !(yMin1 > cell2.y - 1 + (cell2.rowSpan || 1) || yMin2 > yMax1);
2186
2181
  let xMin1 = cell1.x;
2187
2182
  let xMax1 = cell1.x - 1 + (cell1.colSpan || 1);
2188
2183
  let xMin2 = cell2.x;
2189
- let xMax2 = cell2.x - 1 + (cell2.colSpan || 1);
2190
- return yConflict && !(xMin1 > xMax2 || xMin2 > xMax1);
2184
+ let xConflict = !(xMin1 > cell2.x - 1 + (cell2.colSpan || 1) || xMin2 > xMax1);
2185
+ return yConflict && xConflict;
2191
2186
  }
2192
2187
  function conflictExists(rows, x, y$2) {
2193
2188
  let i_max = Math.min(rows.length - 1, y$2);
@@ -2628,7 +2623,7 @@ var ResponsiveTable = class {
2628
2623
  const adjustedWidths = columnWidths.map((width, index) => {
2629
2624
  const align = colAligns[index];
2630
2625
  let adjustedWidth = Math.floor(width * scaleFactor);
2631
- if (align === "right") adjustedWidth = Math.max(adjustedWidth, 10);
2626
+ if (align === "right") adjustedWidth = Math.max(adjustedWidth, 14);
2632
2627
  else if (index === 0) adjustedWidth = Math.max(adjustedWidth, 10);
2633
2628
  else if (index === 1) adjustedWidth = Math.max(adjustedWidth, 12);
2634
2629
  else adjustedWidth = Math.max(adjustedWidth, 8);
@@ -2768,11 +2763,10 @@ var unpackObjectSorter = function(sortByObj) {
2768
2763
  var sortBy = asc || desc;
2769
2764
  throwInvalidConfigErrorIfTrue(!sortBy, "Expected `asc` or `desc` property");
2770
2765
  throwInvalidConfigErrorIfTrue(asc && desc, "Ambiguous object with `asc` and `desc` config properties");
2771
- var comparer = sortByObj.comparer && castComparer(sortByObj.comparer);
2772
2766
  return {
2773
2767
  order,
2774
2768
  sortBy,
2775
- comparer
2769
+ comparer: sortByObj.comparer && castComparer(sortByObj.comparer)
2776
2770
  };
2777
2771
  };
2778
2772
  var multiPropertySorterProvider = function(defaultComparer$1) {
@@ -3282,8 +3276,7 @@ function normalizePath(path$1, options) {
3282
3276
  if (resolvePaths) path$1 = resolve(path$1);
3283
3277
  if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1);
3284
3278
  if (path$1 === ".") return "";
3285
- const needsSeperator = path$1[path$1.length - 1] !== pathSeparator;
3286
- return convertSlashes(needsSeperator ? path$1 + pathSeparator : path$1, pathSeparator);
3279
+ return convertSlashes(path$1[path$1.length - 1] !== pathSeparator ? path$1 + pathSeparator : path$1, pathSeparator);
3287
3280
  }
3288
3281
  function joinPathWithBasePath(filename, directoryPath) {
3289
3282
  return directoryPath + filename;
@@ -3762,12 +3755,6 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3762
3755
  const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
3763
3756
  const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
3764
3757
  const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
3765
- const NO_DOT = `(?!${DOT_LITERAL})`;
3766
- const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
3767
- const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
3768
- const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
3769
- const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
3770
- const STAR = `${QMARK}*?`;
3771
3758
  const POSIX_CHARS = {
3772
3759
  DOT_LITERAL,
3773
3760
  PLUS_LITERAL,
@@ -3777,12 +3764,12 @@ var require_constants = /* @__PURE__ */ __commonJSMin(((exports, module) => {
3777
3764
  QMARK,
3778
3765
  END_ANCHOR,
3779
3766
  DOTS_SLASH,
3780
- NO_DOT,
3781
- NO_DOTS,
3782
- NO_DOT_SLASH,
3783
- NO_DOTS_SLASH,
3784
- QMARK_NO_DOT,
3785
- STAR,
3767
+ NO_DOT: `(?!${DOT_LITERAL})`,
3768
+ NO_DOTS: `(?!${START_ANCHOR}${DOTS_SLASH})`,
3769
+ NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`,
3770
+ NO_DOTS_SLASH: `(?!${DOTS_SLASH})`,
3771
+ QMARK_NO_DOT: `[^.${SLASH_LITERAL}]`,
3772
+ STAR: `${QMARK}*?`,
3786
3773
  START_ANCHOR,
3787
3774
  SEP: "/"
3788
3775
  };
@@ -3943,9 +3930,7 @@ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3943
3930
  return output;
3944
3931
  };
3945
3932
  exports.wrapOutput = (input, state = {}, options = {}) => {
3946
- const prepend = options.contains ? "" : "^";
3947
- const append = options.contains ? "" : "$";
3948
- let output = `${prepend}(?:${input})${append}`;
3933
+ let output = `${options.contains ? "" : "^"}(?:${input})${options.contains ? "" : "$"}`;
3949
3934
  if (state.negated === true) output = `(?:^(?!${output}).*$)`;
3950
3935
  return output;
3951
3936
  };
@@ -4259,13 +4244,13 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4259
4244
  const capture = opts.capture ? "" : "?:";
4260
4245
  const PLATFORM_CHARS = constants$1.globChars(opts.windows);
4261
4246
  const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS);
4262
- const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOT_SLASH: NO_DOT_SLASH$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, QMARK: QMARK$1, QMARK_NO_DOT: QMARK_NO_DOT$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
4247
+ const { DOT_LITERAL: DOT_LITERAL$1, PLUS_LITERAL: PLUS_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOT_SLASH, NO_DOTS_SLASH, QMARK: QMARK$1, QMARK_NO_DOT, STAR, START_ANCHOR: START_ANCHOR$1 } = PLATFORM_CHARS;
4263
4248
  const globstar = (opts$1) => {
4264
4249
  return `(${capture}(?:(?!${START_ANCHOR$1}${opts$1.dot ? DOTS_SLASH$1 : DOT_LITERAL$1}).)*?)`;
4265
4250
  };
4266
- const nodot = opts.dot ? "" : NO_DOT$1;
4267
- const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT$1;
4268
- let star = opts.bash === true ? globstar(opts) : STAR$1;
4251
+ const nodot = opts.dot ? "" : NO_DOT;
4252
+ const qmarkNoDot = opts.dot ? QMARK$1 : QMARK_NO_DOT;
4253
+ let star = opts.bash === true ? globstar(opts) : STAR;
4269
4254
  if (opts.capture) star = `(${star})`;
4270
4255
  if (typeof opts.noext === "boolean") opts.noextglob = opts.noext;
4271
4256
  const state = {
@@ -4462,8 +4447,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4462
4447
  if (inner.includes(":")) {
4463
4448
  const idx = prev.value.lastIndexOf("[");
4464
4449
  const pre = prev.value.slice(0, idx);
4465
- const rest$1 = prev.value.slice(idx + 2);
4466
- const posix$1 = POSIX_REGEX_SOURCE[rest$1];
4450
+ const posix$1 = POSIX_REGEX_SOURCE[prev.value.slice(idx + 2)];
4467
4451
  if (posix$1) {
4468
4452
  prev.value = pre + posix$1;
4469
4453
  state.backtrack = true;
@@ -4699,7 +4683,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4699
4683
  push({
4700
4684
  type: "qmark",
4701
4685
  value,
4702
- output: QMARK_NO_DOT$1
4686
+ output: QMARK_NO_DOT
4703
4687
  });
4704
4688
  continue;
4705
4689
  }
@@ -4903,11 +4887,11 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4903
4887
  }
4904
4888
  if (state.index === state.start || prev.type === "slash" || prev.type === "dot") {
4905
4889
  if (prev.type === "dot") {
4906
- state.output += NO_DOT_SLASH$1;
4907
- prev.output += NO_DOT_SLASH$1;
4890
+ state.output += NO_DOT_SLASH;
4891
+ prev.output += NO_DOT_SLASH;
4908
4892
  } else if (opts.dot === true) {
4909
- state.output += NO_DOTS_SLASH$1;
4910
- prev.output += NO_DOTS_SLASH$1;
4893
+ state.output += NO_DOTS_SLASH;
4894
+ prev.output += NO_DOTS_SLASH;
4911
4895
  } else {
4912
4896
  state.output += nodot;
4913
4897
  prev.output += nodot;
@@ -4954,15 +4938,15 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4954
4938
  const len = input.length;
4955
4939
  if (len > max) throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
4956
4940
  input = REPLACEMENTS[input] || input;
4957
- const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT: NO_DOT$1, NO_DOTS: NO_DOTS$1, NO_DOTS_SLASH: NO_DOTS_SLASH$1, STAR: STAR$1, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
4958
- const nodot = opts.dot ? NO_DOTS$1 : NO_DOT$1;
4959
- const slashDot = opts.dot ? NO_DOTS_SLASH$1 : NO_DOT$1;
4941
+ const { DOT_LITERAL: DOT_LITERAL$1, SLASH_LITERAL: SLASH_LITERAL$1, ONE_CHAR: ONE_CHAR$1, DOTS_SLASH: DOTS_SLASH$1, NO_DOT, NO_DOTS, NO_DOTS_SLASH, STAR, START_ANCHOR: START_ANCHOR$1 } = constants$1.globChars(opts.windows);
4942
+ const nodot = opts.dot ? NO_DOTS : NO_DOT;
4943
+ const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
4960
4944
  const capture = opts.capture ? "" : "?:";
4961
4945
  const state = {
4962
4946
  negated: false,
4963
4947
  prefix: ""
4964
4948
  };
4965
- let star = opts.bash === true ? ".*?" : STAR$1;
4949
+ let star = opts.bash === true ? ".*?" : STAR;
4966
4950
  if (opts.capture) star = `(${star})`;
4967
4951
  const globstar = (opts$1) => {
4968
4952
  if (opts$1.noglobstar === true) return star;
@@ -4987,8 +4971,7 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4987
4971
  }
4988
4972
  }
4989
4973
  };
4990
- const output = utils$2.removePrefix(input, state);
4991
- let source = create$1(output);
4974
+ let source = create$1(utils$2.removePrefix(input, state));
4992
4975
  if (source && opts.strictSlashes !== true) source += `${SLASH_LITERAL$1}?`;
4993
4976
  return source;
4994
4977
  };
@@ -5400,8 +5383,7 @@ async function glob(patternsOrOptions, options) {
5400
5383
  if (patternsOrOptions && (options === null || options === void 0 ? void 0 : options.patterns)) throw new Error("Cannot pass patterns as both an argument and an option");
5401
5384
  const isModern = isReadonlyArray(patternsOrOptions) || typeof patternsOrOptions === "string";
5402
5385
  const opts = isModern ? options : patternsOrOptions;
5403
- const patterns = isModern ? patternsOrOptions : patternsOrOptions.patterns;
5404
- const [crawler, relative$1] = getCrawler(patterns, opts);
5386
+ const [crawler, relative$1] = getCrawler(isModern ? patternsOrOptions : patternsOrOptions.patterns, opts);
5405
5387
  if (!relative$1) return crawler.withPromise();
5406
5388
  return formatPaths(await crawler.withPromise(), relative$1);
5407
5389
  }
@@ -6052,11 +6034,10 @@ ${indent}`);
6052
6034
  return causedPrefix + message + "\n" + stack + causedError;
6053
6035
  }
6054
6036
  formatArgs(args, opts) {
6055
- const _args = args.map((arg) => {
6037
+ return formatWithOptions(opts, ...args.map((arg) => {
6056
6038
  if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
6057
6039
  return arg;
6058
- });
6059
- return formatWithOptions(opts, ..._args);
6040
+ }));
6060
6041
  }
6061
6042
  formatDate(date, opts) {
6062
6043
  return opts.date ? date.toLocaleTimeString() : "";
@@ -6078,11 +6059,10 @@ ${indent}`);
6078
6059
  ]);
6079
6060
  }
6080
6061
  log(logObj, ctx) {
6081
- const line = this.formatLogObj(logObj, {
6062
+ return writeStream(this.formatLogObj(logObj, {
6082
6063
  columns: ctx.options.stdout.columns || 0,
6083
6064
  ...ctx.options.formatOptions
6084
- });
6085
- return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
6065
+ }) + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
6086
6066
  }
6087
6067
  };
6088
6068
  const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
@@ -6276,8 +6256,7 @@ const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta
6276
6256
  return i()[s$1] ?? r[s$1];
6277
6257
  },
6278
6258
  has(e, s$1) {
6279
- const E = i();
6280
- return s$1 in E || s$1 in r;
6259
+ return s$1 in i() || s$1 in r;
6281
6260
  },
6282
6261
  set(e, s$1, E) {
6283
6262
  const B = i(true);
@@ -6574,7 +6553,7 @@ function createConsola$1(options = {}) {
6574
6553
  defaults: { level: level$1 },
6575
6554
  stdout: process.stdout,
6576
6555
  stderr: process.stderr,
6577
- prompt: (...args) => import("./prompt-C-goQ9sU.js").then((m$1) => m$1.prompt(...args)),
6556
+ prompt: (...args) => import("./prompt-CRRaPhnO.js").then((m$1) => m$1.prompt(...args)),
6578
6557
  reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
6579
6558
  ...options
6580
6559
  });
@@ -6761,8 +6740,7 @@ async function loadTokenUsageEvents(options = {}) {
6761
6740
  const delta = convertToDelta(raw);
6762
6741
  if (delta.inputTokens === 0 && delta.cachedInputTokens === 0 && delta.outputTokens === 0 && delta.reasoningOutputTokens === 0) continue;
6763
6742
  const payloadRecordResult = /* @__PURE__ */ safeParse(recordSchema, payload ?? void 0);
6764
- const extractionSource = payloadRecordResult.success ? Object.assign({}, payloadRecordResult.output, { info: info$1 }) : { info: info$1 };
6765
- const extractedModel = extractModel(extractionSource);
6743
+ const extractedModel = extractModel(payloadRecordResult.success ? Object.assign({}, payloadRecordResult.output, { info: info$1 }) : { info: info$1 });
6766
6744
  let isFallbackModel = false;
6767
6745
  if (extractedModel != null) {
6768
6746
  currentModel = extractedModel;
@@ -7037,15 +7015,14 @@ const PREFETCHED_CODEX_PRICING = {
7037
7015
  "max_input_tokens": 272e3,
7038
7016
  "max_output_tokens": 128e3
7039
7017
  },
7040
- "gpt-5": {
7041
- "input_cost_per_token": 125e-8,
7042
- "output_cost_per_token": 1e-5,
7043
- "cache_read_input_token_cost": 125e-9,
7044
- "max_tokens": 128e3,
7018
+ "azure/gpt-5-pro": {
7019
+ "input_cost_per_token": 15e-6,
7020
+ "output_cost_per_token": 12e-5,
7021
+ "max_tokens": 4e5,
7045
7022
  "max_input_tokens": 272e3,
7046
7023
  "max_output_tokens": 128e3
7047
7024
  },
7048
- "gpt-5-codex": {
7025
+ "gpt-5": {
7049
7026
  "input_cost_per_token": 125e-8,
7050
7027
  "output_cost_per_token": 1e-5,
7051
7028
  "cache_read_input_token_cost": 125e-9,
@@ -7053,6 +7030,20 @@ const PREFETCHED_CODEX_PRICING = {
7053
7030
  "max_input_tokens": 272e3,
7054
7031
  "max_output_tokens": 128e3
7055
7032
  },
7033
+ "gpt-5-pro": {
7034
+ "input_cost_per_token": 15e-6,
7035
+ "output_cost_per_token": 12e-5,
7036
+ "max_tokens": 272e3,
7037
+ "max_input_tokens": 4e5,
7038
+ "max_output_tokens": 272e3
7039
+ },
7040
+ "gpt-5-pro-2025-10-06": {
7041
+ "input_cost_per_token": 15e-6,
7042
+ "output_cost_per_token": 12e-5,
7043
+ "max_tokens": 272e3,
7044
+ "max_input_tokens": 4e5,
7045
+ "max_output_tokens": 272e3
7046
+ },
7056
7047
  "gpt-5-2025-08-07": {
7057
7048
  "input_cost_per_token": 125e-8,
7058
7049
  "output_cost_per_token": 1e-5,
@@ -7077,6 +7068,14 @@ const PREFETCHED_CODEX_PRICING = {
7077
7068
  "max_input_tokens": 128e3,
7078
7069
  "max_output_tokens": 16384
7079
7070
  },
7071
+ "gpt-5-codex": {
7072
+ "input_cost_per_token": 125e-8,
7073
+ "output_cost_per_token": 1e-5,
7074
+ "cache_read_input_token_cost": 125e-9,
7075
+ "max_tokens": 128e3,
7076
+ "max_input_tokens": 272e3,
7077
+ "max_output_tokens": 128e3
7078
+ },
7080
7079
  "gpt-5-mini": {
7081
7080
  "input_cost_per_token": 25e-8,
7082
7081
  "output_cost_per_token": 2e-6,
@@ -7360,8 +7359,7 @@ async function buildMonthlyReport(events, options) {
7360
7359
  for (const event of events) {
7361
7360
  const modelName = event.model?.trim();
7362
7361
  if (modelName == null || modelName === "") continue;
7363
- const dateKey = toDateKey(event.timestamp, timezone);
7364
- if (!isWithinRange(dateKey, since, until)) continue;
7362
+ if (!isWithinRange(toDateKey(event.timestamp, timezone), since, until)) continue;
7365
7363
  const monthKey = toMonthKey(event.timestamp, timezone);
7366
7364
  const summary = summaries.get(monthKey) ?? createSummary$1(monthKey, event.timestamp);
7367
7365
  if (!summaries.has(monthKey)) summaries.set(monthKey, summary);
@@ -7586,8 +7584,7 @@ async function buildSessionReport(events, options) {
7586
7584
  if (rawModelName == null) continue;
7587
7585
  const modelName = rawModelName.trim();
7588
7586
  if (modelName === "") continue;
7589
- const dateKey = toDateKey(event.timestamp, timezone);
7590
- if (!isWithinRange(dateKey, since, until)) continue;
7587
+ if (!isWithinRange(toDateKey(event.timestamp, timezone), since, until)) continue;
7591
7588
  const summary = summaries.get(sessionId) ?? createSummary(sessionId, event.timestamp);
7592
7589
  if (!summaries.has(sessionId)) summaries.set(sessionId, summary);
7593
7590
  addUsage(summary, event);
@@ -7766,8 +7763,7 @@ const sessionCommand = define({
7766
7763
  totalsForDisplay.cacheReadTokens += split.cacheReadTokens;
7767
7764
  totalsForDisplay.totalTokens += row.totalTokens;
7768
7765
  totalsForDisplay.costUSD += row.costUSD;
7769
- const dateKey = toDateKey(row.lastActivity, ctx.values.timezone);
7770
- const displayDate = formatDisplayDate(dateKey, ctx.values.locale, ctx.values.timezone);
7766
+ const displayDate = formatDisplayDate(toDateKey(row.lastActivity, ctx.values.timezone), ctx.values.locale, ctx.values.timezone);
7771
7767
  const directoryDisplay = row.directory === "" ? "-" : row.directory;
7772
7768
  const sessionFile = row.sessionFile;
7773
7769
  const shortSession = sessionFile.length > 8 ? `…${sessionFile.slice(-8)}` : sessionFile;
@@ -37,28 +37,26 @@ function requireSrc() {
37
37
  save: `${ESC}7`,
38
38
  restore: `${ESC}8`
39
39
  };
40
- const scroll = {
41
- up: (count = 1) => `${CSI}S`.repeat(count),
42
- down: (count = 1) => `${CSI}T`.repeat(count)
43
- };
44
- const erase = {
45
- screen: `${CSI}2J`,
46
- up: (count = 1) => `${CSI}1J`.repeat(count),
47
- down: (count = 1) => `${CSI}J`.repeat(count),
48
- line: `${CSI}2K`,
49
- lineEnd: `${CSI}K`,
50
- lineStart: `${CSI}1K`,
51
- lines(count) {
52
- let clear = "";
53
- for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
54
- if (count) clear += cursor.left;
55
- return clear;
56
- }
57
- };
58
40
  src = {
59
41
  cursor,
60
- scroll,
61
- erase,
42
+ scroll: {
43
+ up: (count = 1) => `${CSI}S`.repeat(count),
44
+ down: (count = 1) => `${CSI}T`.repeat(count)
45
+ },
46
+ erase: {
47
+ screen: `${CSI}2J`,
48
+ up: (count = 1) => `${CSI}1J`.repeat(count),
49
+ down: (count = 1) => `${CSI}J`.repeat(count),
50
+ line: `${CSI}2K`,
51
+ lineEnd: `${CSI}K`,
52
+ lineStart: `${CSI}1K`,
53
+ lines(count) {
54
+ let clear = "";
55
+ for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
56
+ if (count) clear += cursor.left;
57
+ return clear;
58
+ }
59
+ },
62
60
  beep
63
61
  };
64
62
  return src;
@@ -399,16 +397,16 @@ function G(t, u$1, F$1) {
399
397
  `).map((e$1) => oD(e$1, u$1, F$1)).join(`
400
398
  `);
401
399
  }
402
- const aD = [
403
- "up",
404
- "down",
405
- "left",
406
- "right",
407
- "space",
408
- "enter",
409
- "cancel"
410
- ], c = {
411
- actions: new Set(aD),
400
+ const c = {
401
+ actions: new Set([
402
+ "up",
403
+ "down",
404
+ "left",
405
+ "right",
406
+ "space",
407
+ "enter",
408
+ "cancel"
409
+ ]),
412
410
  aliases: new Map([
413
411
  ["k", "up"],
414
412
  ["j", "down"],
@@ -842,4 +840,4 @@ async function prompt(message, opts = {}) {
842
840
  }).then(handleCancel);
843
841
  throw new Error(`Unknown prompt type: ${opts.type}`);
844
842
  }
845
- export { prompt };
843
+ export { kCancel, prompt };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccusage/codex",
3
- "version": "17.1.2",
3
+ "version": "17.1.4",
4
4
  "description": "Usage analysis tool for OpenAI Codex sessions",
5
5
  "homepage": "https://github.com/ryoppippi/ccusage#readme",
6
6
  "bugs": {