open-azdo 0.2.7 → 0.2.9

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/open-azdo.js CHANGED
@@ -47256,6 +47256,12 @@ var buildOpenCodeArgs = (request3) => [
47256
47256
  ];
47257
47257
  var isRecord = (value3) => typeof value3 === "object" && value3 !== null && !Array.isArray(value3);
47258
47258
  var toNumberOrUndefined = (value3) => typeof value3 === "number" && Number.isFinite(value3) ? value3 : undefined;
47259
+ var getNestedCacheTokenCount = (value3, key) => {
47260
+ if (!isRecord(value3) || !isRecord(value3.cache)) {
47261
+ return;
47262
+ }
47263
+ return toNumberOrUndefined(value3.cache[key]);
47264
+ };
47259
47265
  var parseTokenUsage = (value3) => {
47260
47266
  if (!isRecord(value3)) {
47261
47267
  return;
@@ -47269,8 +47275,8 @@ var parseTokenUsage = (value3) => {
47269
47275
  input,
47270
47276
  output,
47271
47277
  reasoning: toNumberOrUndefined(value3.reasoning) ?? 0,
47272
- cacheRead: toNumberOrUndefined(value3.cacheRead) ?? 0,
47273
- cacheWrite: toNumberOrUndefined(value3.cacheWrite) ?? 0
47278
+ cacheRead: toNumberOrUndefined(value3.cacheRead) ?? getNestedCacheTokenCount(value3, "read") ?? 0,
47279
+ cacheWrite: toNumberOrUndefined(value3.cacheWrite) ?? getNestedCacheTokenCount(value3, "write") ?? 0
47274
47280
  };
47275
47281
  };
47276
47282
  var buildUsage = ({
@@ -47618,6 +47624,7 @@ var ReviewHistoryTokensSchema = exports_Schema.Struct({
47618
47624
  });
47619
47625
  var ReviewHistoryEntrySchema = exports_Schema.Struct({
47620
47626
  reviewedCommit: exports_Schema.String,
47627
+ reviewedAt: exports_Schema.optionalKey(exports_Schema.String),
47621
47628
  reviewMode: exports_Schema.Literals(["full", "follow-up"]),
47622
47629
  model: exports_Schema.String,
47623
47630
  variant: exports_Schema.optionalKey(exports_Schema.String),
@@ -47718,6 +47725,21 @@ var formatReviewLabel = (entry) => {
47718
47725
  }
47719
47726
  return commitLabel;
47720
47727
  };
47728
+ var formatReviewTimestamp = (entry) => {
47729
+ if (!entry.reviewedAt) {
47730
+ return "-";
47731
+ }
47732
+ const date5 = new Date(entry.reviewedAt);
47733
+ if (Number.isNaN(date5.valueOf())) {
47734
+ return entry.reviewedAt;
47735
+ }
47736
+ return new Intl.DateTimeFormat("en-US", {
47737
+ dateStyle: "medium",
47738
+ timeStyle: "short",
47739
+ hour12: false,
47740
+ timeZone: "UTC"
47741
+ }).format(date5);
47742
+ };
47721
47743
  var formatTokenBreakdown = (tokens) => {
47722
47744
  if (!tokens) {
47723
47745
  return "-";
@@ -47739,9 +47761,9 @@ var appendReviewHistorySection = (lines, reviewHistory) => {
47739
47761
  if (reviewHistory.length === 0) {
47740
47762
  return;
47741
47763
  }
47742
- lines.push("", "| Review | Mode | Model | Tokens | Cost |", "| --- | --- | --- | --- | --- |");
47743
- for (const entry of reviewHistory) {
47744
- lines.push(`| ${escapeTableCell(formatReviewLabel(entry))} | ${escapeTableCell(entry.reviewMode)} | ${escapeTableCell(formatModelLabel(entry))} | ${escapeTableCell(formatTokenBreakdown(entry.tokens))} | ${escapeTableCell(entry.costUsd !== undefined ? formatCostUsd(entry.costUsd) : "-")} |`);
47764
+ lines.push("", "| Review | Reviewed At (UTC) | Mode | Model | Tokens | Cost |", "| --- | --- | --- | --- | --- | --- |");
47765
+ for (const entry of [...reviewHistory].reverse()) {
47766
+ lines.push(`| ${escapeTableCell(formatReviewLabel(entry))} | ${escapeTableCell(formatReviewTimestamp(entry))} | ${escapeTableCell(entry.reviewMode)} | ${escapeTableCell(formatModelLabel(entry))} | ${escapeTableCell(formatTokenBreakdown(entry.tokens))} | ${escapeTableCell(entry.costUsd !== undefined ? formatCostUsd(entry.costUsd) : "-")} |`);
47745
47767
  }
47746
47768
  };
47747
47769
  var buildSummaryComment = (snapshot) => {
@@ -48200,6 +48222,7 @@ var buildReviewHistoryEntry = ({
48200
48222
  const tokens = mapUsageTokens(usage);
48201
48223
  return {
48202
48224
  reviewedCommit,
48225
+ reviewedAt: new Date().toISOString(),
48203
48226
  reviewMode,
48204
48227
  model: config.model,
48205
48228
  ...config.opencodeVariant ? { variant: config.opencodeVariant } : {},
@@ -48694,7 +48717,7 @@ var reviewCommandConfig = {
48694
48717
  var reviewCommand = make33("review", reviewCommandConfig).pipe(withDescription3("Review an Azure DevOps pull request with OpenCode."), withHandler((input) => runReviewCommand(input)));
48695
48718
  var openAzdoCli = make33("open-azdo").pipe(withDescription3("Secure Azure DevOps pull-request review CLI powered by OpenCode."), withSubcommands([reviewCommand]));
48696
48719
  // package.json
48697
- var version2 = "0.2.7";
48720
+ var version2 = "0.2.9";
48698
48721
 
48699
48722
  // src/Main.ts
48700
48723
  var cliProgram = run3(openAzdoCli, { version: version2 }).pipe(exports_Effect.scoped, exports_Effect.provide(BaseRuntimeLayer));
@@ -48703,4 +48726,4 @@ var main = () => runMain2(cliProgram, { disableErrorReporting: true });
48703
48726
  // bin/open-azdo.ts
48704
48727
  main();
48705
48728
 
48706
- //# debugId=DE545330B8B0705764756E2164756E21
48729
+ //# debugId=940B5A0DAA7340FB64756E2164756E21