@jphutchins/code-review 0.1.0-alpha.49 → 0.1.0-alpha.50
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 +23 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -861,6 +861,7 @@ var reviewBodyPointer = (headSha, stickyUrl) => {
|
|
|
861
861
|
var asRecord = (u) => typeof u === "object" && u !== null && !Array.isArray(u) ? u : null;
|
|
862
862
|
var errMsg = (e) => e instanceof Error ? e.message : String(e);
|
|
863
863
|
var annotationSafe = (msg) => msg.replaceAll(/[\r\n]+/g, " ");
|
|
864
|
+
var modelIdentity = (configuredModelId) => configuredModelId.replace(/\[[12]m\]$/i, "");
|
|
864
865
|
var clipText = (body, max) => {
|
|
865
866
|
if (body.length <= max) return body;
|
|
866
867
|
const cut = body.slice(0, max);
|
|
@@ -899,7 +900,7 @@ var messageUsage = (entry) => {
|
|
|
899
900
|
const id = msg["id"];
|
|
900
901
|
return {
|
|
901
902
|
id: typeof id === "string" ? id : null,
|
|
902
|
-
model,
|
|
903
|
+
model: modelIdentity(model),
|
|
903
904
|
input: numField(usage, "input_tokens"),
|
|
904
905
|
output: numField(usage, "output_tokens"),
|
|
905
906
|
cacheRead: numField(usage, "cache_read_input_tokens"),
|
|
@@ -3662,13 +3663,27 @@ var ClaudeCodeEnvelopeCodec = t.intersection([
|
|
|
3662
3663
|
structured_output: t.unknown
|
|
3663
3664
|
})
|
|
3664
3665
|
]);
|
|
3665
|
-
var
|
|
3666
|
-
|
|
3667
|
-
input_tokens: entry.
|
|
3668
|
-
output_tokens: entry.
|
|
3669
|
-
...entry.
|
|
3670
|
-
...entry.
|
|
3671
|
-
})
|
|
3666
|
+
var sumUsage = (into, entry) => ({
|
|
3667
|
+
...into,
|
|
3668
|
+
input_tokens: into.input_tokens + entry.input_tokens,
|
|
3669
|
+
output_tokens: into.output_tokens + entry.output_tokens,
|
|
3670
|
+
...into.cache_read_tokens !== void 0 || entry.cache_read_tokens !== void 0 ? { cache_read_tokens: (into.cache_read_tokens ?? 0) + (entry.cache_read_tokens ?? 0) } : {},
|
|
3671
|
+
...into.cache_write_tokens !== void 0 || entry.cache_write_tokens !== void 0 ? { cache_write_tokens: (into.cache_write_tokens ?? 0) + (entry.cache_write_tokens ?? 0) } : {}
|
|
3672
|
+
});
|
|
3673
|
+
var mapModelUsage = (modelUsage) => [
|
|
3674
|
+
...Object.entries(modelUsage).reduce((byModel, [configuredModelId, entry]) => {
|
|
3675
|
+
const model = modelIdentity(configuredModelId);
|
|
3676
|
+
const mapped = {
|
|
3677
|
+
model,
|
|
3678
|
+
input_tokens: entry.inputTokens,
|
|
3679
|
+
output_tokens: entry.outputTokens,
|
|
3680
|
+
...entry.cacheReadInputTokens !== void 0 ? { cache_read_tokens: entry.cacheReadInputTokens } : {},
|
|
3681
|
+
...entry.cacheCreationInputTokens !== void 0 ? { cache_write_tokens: entry.cacheCreationInputTokens } : {}
|
|
3682
|
+
};
|
|
3683
|
+
const prior = byModel.get(model);
|
|
3684
|
+
return byModel.set(model, prior === void 0 ? mapped : sumUsage(prior, mapped));
|
|
3685
|
+
}, /* @__PURE__ */ new Map()).values()
|
|
3686
|
+
];
|
|
3672
3687
|
var findingsOutcome = (native, agentFilePath, agentFileFallbackPath) => {
|
|
3673
3688
|
const ladder = extractStructured({
|
|
3674
3689
|
kind: "findings",
|