altimate-receipts 0.7.0 → 0.9.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 +158 -175
- package/dist/{chunk-MSPULJEI.js → chunk-4S2ABMUN.js} +2 -2
- package/dist/{chunk-ZORGM2DA.js → chunk-TUWJRD7H.js} +333 -35
- package/dist/chunk-TUWJRD7H.js.map +1 -0
- package/dist/chunk-WNGBYBM3.js +859 -0
- package/dist/chunk-WNGBYBM3.js.map +1 -0
- package/dist/cli.js +79 -24
- package/dist/cli.js.map +1 -1
- package/dist/index.js +4 -232
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/package.json +1 -1
- package/schema/agent-execution-receipt-v1.json +62 -0
- package/dist/chunk-FTKMO26V.js +0 -767
- package/dist/chunk-FTKMO26V.js.map +0 -1
- package/dist/chunk-ZORGM2DA.js.map +0 -1
- /package/dist/{chunk-MSPULJEI.js.map → chunk-4S2ABMUN.js.map} +0 -0
|
@@ -2746,6 +2746,296 @@ function gradeLetter(main) {
|
|
|
2746
2746
|
return "A";
|
|
2747
2747
|
}
|
|
2748
2748
|
|
|
2749
|
+
// src/trace/diffScope.ts
|
|
2750
|
+
import { spawnSync } from "child_process";
|
|
2751
|
+
|
|
2752
|
+
// src/findings/surface.ts
|
|
2753
|
+
var OPERATOR_KINDS = /* @__PURE__ */ new Set([
|
|
2754
|
+
"loop",
|
|
2755
|
+
"bottleneck",
|
|
2756
|
+
"cost-concentration",
|
|
2757
|
+
"cache-opportunity",
|
|
2758
|
+
"model-downgrade"
|
|
2759
|
+
]);
|
|
2760
|
+
var PRIVILEGED_PREFIXES = [
|
|
2761
|
+
"ci-cd-touch",
|
|
2762
|
+
"lockfile-edit",
|
|
2763
|
+
"hook-bypass",
|
|
2764
|
+
"config-weaken",
|
|
2765
|
+
"grader-edit",
|
|
2766
|
+
"eval-override",
|
|
2767
|
+
"test-focus",
|
|
2768
|
+
"test-skipped",
|
|
2769
|
+
"test-trivialised",
|
|
2770
|
+
"history-rewrite",
|
|
2771
|
+
"force-push"
|
|
2772
|
+
];
|
|
2773
|
+
var TEST_PATH2 = /(?:^|\/)(?:tests?|specs?|__tests__)(?:\/|$)|\.(?:test|spec)\.|_test\./;
|
|
2774
|
+
function privileged(id, filePath) {
|
|
2775
|
+
if (PRIVILEGED_PREFIXES.some((p) => id.startsWith(p))) {
|
|
2776
|
+
return true;
|
|
2777
|
+
}
|
|
2778
|
+
return id.startsWith("file-shrink") && !!filePath && TEST_PATH2.test(filePath);
|
|
2779
|
+
}
|
|
2780
|
+
function findingSurface(id) {
|
|
2781
|
+
if (OPERATOR_KINDS.has(id) || id.startsWith("errcluster-")) {
|
|
2782
|
+
return "operator";
|
|
2783
|
+
}
|
|
2784
|
+
return "merge";
|
|
2785
|
+
}
|
|
2786
|
+
function destructiveOutsideRepo(title) {
|
|
2787
|
+
const clause = title.replace(/^Destructive op:\s*/i, "").replace(/\s*×\d+\s*$/, "");
|
|
2788
|
+
const m = clause.match(/^\s*(rm|rmdir)\b(.*)$/i);
|
|
2789
|
+
if (!m) {
|
|
2790
|
+
return false;
|
|
2791
|
+
}
|
|
2792
|
+
const operands = m[2].split(/\s+/).filter((t) => t && !t.startsWith("-"));
|
|
2793
|
+
if (operands.length === 0) {
|
|
2794
|
+
return false;
|
|
2795
|
+
}
|
|
2796
|
+
const scratch = (t) => {
|
|
2797
|
+
const p = t.replace(/^["']|["']$/g, "");
|
|
2798
|
+
return /\$/.test(p) || p.startsWith("/tmp") || p.startsWith("/var/folders") || p.startsWith("/private/var/folders") || p.startsWith("~");
|
|
2799
|
+
};
|
|
2800
|
+
return operands.every(scratch);
|
|
2801
|
+
}
|
|
2802
|
+
function regenerableReceiptRm(title) {
|
|
2803
|
+
const clause = title.replace(/^Destructive op:\s*/i, "").replace(/\s*×\d+\s*$/, "");
|
|
2804
|
+
const m = clause.match(/^\s*(rm|rmdir)\b(.*)$/i);
|
|
2805
|
+
if (!m) {
|
|
2806
|
+
return false;
|
|
2807
|
+
}
|
|
2808
|
+
const operands = m[2].split(/\s+/).filter((t) => t && !t.startsWith("-"));
|
|
2809
|
+
if (operands.length === 0) {
|
|
2810
|
+
return false;
|
|
2811
|
+
}
|
|
2812
|
+
const receiptJson = (t) => /(?:^|\/)\.receipts\/[^/]+\.json$/.test(t.replace(/^["']|["']$/g, ""));
|
|
2813
|
+
return operands.every(receiptJson);
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
// src/trace/diffScope.ts
|
|
2817
|
+
function git(args, cwd) {
|
|
2818
|
+
const r = spawnSync("git", args, { encoding: "utf8", cwd });
|
|
2819
|
+
return r.status === 0 ? r.stdout : null;
|
|
2820
|
+
}
|
|
2821
|
+
var RECEIPTS_DIR_RE = /(?:^|\/)\.receipts\//;
|
|
2822
|
+
function changedFiles(baseOverride, opts) {
|
|
2823
|
+
const root = git(["rev-parse", "--show-toplevel"])?.trim();
|
|
2824
|
+
if (!root) {
|
|
2825
|
+
return null;
|
|
2826
|
+
}
|
|
2827
|
+
let base4 = baseOverride;
|
|
2828
|
+
if (!base4) {
|
|
2829
|
+
const sym = git(["symbolic-ref", "refs/remotes/origin/HEAD"], root)?.trim();
|
|
2830
|
+
if (sym) {
|
|
2831
|
+
base4 = sym.replace("refs/remotes/", "");
|
|
2832
|
+
} else if (git(["rev-parse", "--verify", "--quiet", "origin/main"], root) !== null) {
|
|
2833
|
+
base4 = "origin/main";
|
|
2834
|
+
} else {
|
|
2835
|
+
base4 = "main";
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
let out = git(["diff", "--name-only", `${base4}...HEAD`], root);
|
|
2839
|
+
if (out === null && !baseOverride) {
|
|
2840
|
+
out = git(["diff", "--name-only", "main...HEAD"], root);
|
|
2841
|
+
if (out !== null) {
|
|
2842
|
+
base4 = "main";
|
|
2843
|
+
}
|
|
2844
|
+
}
|
|
2845
|
+
const pending = opts?.includeWorkingTree ? workingTreeFiles(root) : [];
|
|
2846
|
+
if (out === null && pending.length === 0) {
|
|
2847
|
+
return null;
|
|
2848
|
+
}
|
|
2849
|
+
const files = [.../* @__PURE__ */ new Set([...(out ?? "").split("\n").map((s) => s.trim()), ...pending])].filter(Boolean).filter((f) => !RECEIPTS_DIR_RE.test(f)).sort();
|
|
2850
|
+
if (files.length === 0) {
|
|
2851
|
+
return null;
|
|
2852
|
+
}
|
|
2853
|
+
return { base: base4, files, repoRoot: root };
|
|
2854
|
+
}
|
|
2855
|
+
function workingTreeFiles(root) {
|
|
2856
|
+
const out = git(["status", "--porcelain", "-z", "--untracked-files=all"], root);
|
|
2857
|
+
if (!out) {
|
|
2858
|
+
return [];
|
|
2859
|
+
}
|
|
2860
|
+
const toks = out.split("\0");
|
|
2861
|
+
const files = [];
|
|
2862
|
+
for (let i = 0; i < toks.length; i++) {
|
|
2863
|
+
const t = toks[i];
|
|
2864
|
+
if (!t || t.length < 4 || t[2] !== " ") {
|
|
2865
|
+
continue;
|
|
2866
|
+
}
|
|
2867
|
+
files.push(t.slice(3));
|
|
2868
|
+
if (t[0] === "R" || t[0] === "C") {
|
|
2869
|
+
i++;
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
return files;
|
|
2873
|
+
}
|
|
2874
|
+
function inDiff(filePath, files) {
|
|
2875
|
+
const base4 = filePath.split("/").pop();
|
|
2876
|
+
for (const d of files) {
|
|
2877
|
+
if (d === filePath || d.endsWith(`/${filePath}`) || filePath.endsWith(`/${d}`)) {
|
|
2878
|
+
return true;
|
|
2879
|
+
}
|
|
2880
|
+
if (base4 && d.split("/").pop() === base4) {
|
|
2881
|
+
return true;
|
|
2882
|
+
}
|
|
2883
|
+
}
|
|
2884
|
+
return false;
|
|
2885
|
+
}
|
|
2886
|
+
var PROCESS_PREFIXES = ["pipe-sh", "tool-fabricated", "tool-malformed-args"];
|
|
2887
|
+
var isProcessFinding = (id) => PROCESS_PREFIXES.some((p) => id === p || id.startsWith(`${p}-`));
|
|
2888
|
+
var isDestructive = (id) => id.startsWith("destructive-");
|
|
2889
|
+
var isGitProcess = (id) => id.startsWith("force-push") || id.startsWith("destructive-git");
|
|
2890
|
+
function hookBypassIsPushOnly(command) {
|
|
2891
|
+
const noVerify = parseGitInvocations(command).filter(isNoVerify);
|
|
2892
|
+
return noVerify.length > 0 && noVerify.every((inv) => inv.subcommand === "push");
|
|
2893
|
+
}
|
|
2894
|
+
function gitTouchesDiff(command, files) {
|
|
2895
|
+
for (const inv of parseGitInvocations(command)) {
|
|
2896
|
+
if (!destroysGitData(inv) && !rewritesHistory(inv)) {
|
|
2897
|
+
continue;
|
|
2898
|
+
}
|
|
2899
|
+
if (touchedPaths(inv).some((p) => inDiff(p, files))) {
|
|
2900
|
+
return true;
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
return false;
|
|
2904
|
+
}
|
|
2905
|
+
function keepUnderDiff(f, files, commandFor, locusFor) {
|
|
2906
|
+
if (locusFor?.(f) === "elsewhere") {
|
|
2907
|
+
return false;
|
|
2908
|
+
}
|
|
2909
|
+
if (isProcessFinding(f.id)) {
|
|
2910
|
+
return true;
|
|
2911
|
+
}
|
|
2912
|
+
if (f.id === "hook-bypass" || f.id.startsWith("hook-bypass-")) {
|
|
2913
|
+
const cmd = commandFor?.(f);
|
|
2914
|
+
return cmd ? !hookBypassIsPushOnly(cmd) : true;
|
|
2915
|
+
}
|
|
2916
|
+
if (isGitProcess(f.id)) {
|
|
2917
|
+
const cmd = commandFor?.(f);
|
|
2918
|
+
return cmd ? gitTouchesDiff(cmd, files) : false;
|
|
2919
|
+
}
|
|
2920
|
+
if (isDestructive(f.id)) {
|
|
2921
|
+
if (destructiveOutsideRepo(f.title) || regenerableReceiptRm(f.title)) {
|
|
2922
|
+
return false;
|
|
2923
|
+
}
|
|
2924
|
+
const cmd = commandFor?.(f) ?? f.title.replace(/^Destructive op:\s*/i, "").replace(/\s*×\d+\s*$/, "");
|
|
2925
|
+
if (/(^|[\s;&|])git\s/.test(cmd)) {
|
|
2926
|
+
return gitTouchesDiff(cmd, files);
|
|
2927
|
+
}
|
|
2928
|
+
return true;
|
|
2929
|
+
}
|
|
2930
|
+
return f.filePath ? inDiff(f.filePath, files) : false;
|
|
2931
|
+
}
|
|
2932
|
+
function commandMentionsFile(cmd, files) {
|
|
2933
|
+
if (!cmd) {
|
|
2934
|
+
return false;
|
|
2935
|
+
}
|
|
2936
|
+
return files.some(
|
|
2937
|
+
(f) => f.includes("/") ? cmd.includes(f) : new RegExp(`(?:^|[\\s'"\`=/])${f.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`).test(cmd)
|
|
2938
|
+
);
|
|
2939
|
+
}
|
|
2940
|
+
function diffEffort(derived, files, window) {
|
|
2941
|
+
const editedGens = /* @__PURE__ */ new Set();
|
|
2942
|
+
derived.spans.forEach((s, i) => {
|
|
2943
|
+
if (s.kind !== "tool" || !s.parentSpanId) {
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2946
|
+
if (window && (i < window.start || i > window.end)) {
|
|
2947
|
+
return;
|
|
2948
|
+
}
|
|
2949
|
+
if (isEditTool(s.name)) {
|
|
2950
|
+
const fp = filePathOf(s.input);
|
|
2951
|
+
if (fp && inDiff(fp, files)) {
|
|
2952
|
+
editedGens.add(s.parentSpanId);
|
|
2953
|
+
}
|
|
2954
|
+
return;
|
|
2955
|
+
}
|
|
2956
|
+
if (isCommandTool(s.name) && commandMentionsFile(commandOf(s.input), files)) {
|
|
2957
|
+
editedGens.add(s.parentSpanId);
|
|
2958
|
+
}
|
|
2959
|
+
});
|
|
2960
|
+
let cost = 0;
|
|
2961
|
+
let tokens = 0;
|
|
2962
|
+
for (const s of derived.spans) {
|
|
2963
|
+
if (s.kind === "generation" && editedGens.has(s.spanId)) {
|
|
2964
|
+
cost += s.cost || estimateCost(s.tokens, s.name);
|
|
2965
|
+
tokens += s.tokens?.total ?? 0;
|
|
2966
|
+
}
|
|
2967
|
+
}
|
|
2968
|
+
return { cost, tokens, turns: editedGens.size };
|
|
2969
|
+
}
|
|
2970
|
+
function narrowEffort(sliceDerived, files) {
|
|
2971
|
+
if (!sliceDerived) {
|
|
2972
|
+
return null;
|
|
2973
|
+
}
|
|
2974
|
+
const eff = diffEffort(sliceDerived, files);
|
|
2975
|
+
return eff.turns > 0 ? eff : null;
|
|
2976
|
+
}
|
|
2977
|
+
function windowedEffort(derived, files, window) {
|
|
2978
|
+
const eff = diffEffort(derived, files, window);
|
|
2979
|
+
return eff.turns > 0 ? eff : null;
|
|
2980
|
+
}
|
|
2981
|
+
function applyDiffScope(derived, findings, files, projectPath) {
|
|
2982
|
+
const spanCmd = /* @__PURE__ */ new Map();
|
|
2983
|
+
const spanCwd = /* @__PURE__ */ new Map();
|
|
2984
|
+
for (const s of derived.spans) {
|
|
2985
|
+
if (s.spanId) {
|
|
2986
|
+
spanCmd.set(s.spanId, commandOf(s.input));
|
|
2987
|
+
if (s.cwd) {
|
|
2988
|
+
spanCwd.set(s.spanId, s.cwd);
|
|
2989
|
+
}
|
|
2990
|
+
}
|
|
2991
|
+
}
|
|
2992
|
+
const cmdOf = (f) => f.evidenceSpanId ? spanCmd.get(f.evidenceSpanId) : void 0;
|
|
2993
|
+
const locusOf = (f) => {
|
|
2994
|
+
if (!projectPath || !f.evidenceSpanId) {
|
|
2995
|
+
return void 0;
|
|
2996
|
+
}
|
|
2997
|
+
const base4 = spanCwd.get(f.evidenceSpanId);
|
|
2998
|
+
const state = cwdAtFirstGit(spanCmd.get(f.evidenceSpanId) ?? "", base4);
|
|
2999
|
+
if (state.kind === "unknown") {
|
|
3000
|
+
return "elsewhere";
|
|
3001
|
+
}
|
|
3002
|
+
const at = state.kind === "known" ? state.path : base4;
|
|
3003
|
+
if (!at) {
|
|
3004
|
+
return void 0;
|
|
3005
|
+
}
|
|
3006
|
+
return at === projectPath || at.startsWith(`${projectPath}/`) ? "here" : "elsewhere";
|
|
3007
|
+
};
|
|
3008
|
+
const keep = (f) => keepUnderDiff(f, files, cmdOf, locusOf);
|
|
3009
|
+
const scopedFindings = {
|
|
3010
|
+
main: findings.main.filter(keep),
|
|
3011
|
+
minor: findings.minor.filter(keep)
|
|
3012
|
+
};
|
|
3013
|
+
const filesChanged = derived.filesChanged.filter((fc) => inDiff(fc.path, files));
|
|
3014
|
+
const destructiveCount = derived.spans.filter((s) => s.destructive).filter((s) => {
|
|
3015
|
+
const cmd = commandOf(s.input);
|
|
3016
|
+
const clause = destructiveMatch(cmd) ?? cmd;
|
|
3017
|
+
if (destructiveOutsideRepo(clause) || regenerableReceiptRm(clause)) {
|
|
3018
|
+
return false;
|
|
3019
|
+
}
|
|
3020
|
+
if (/(^|[\s;&|])git\s/.test(cmd)) {
|
|
3021
|
+
return gitTouchesDiff(cmd, files);
|
|
3022
|
+
}
|
|
3023
|
+
return true;
|
|
3024
|
+
}).length;
|
|
3025
|
+
const eff = diffEffort(derived, files);
|
|
3026
|
+
return {
|
|
3027
|
+
derived: {
|
|
3028
|
+
...derived,
|
|
3029
|
+
filesChanged,
|
|
3030
|
+
destructiveCount,
|
|
3031
|
+
diffCostUsd: eff.cost,
|
|
3032
|
+
diffTokens: eff.tokens,
|
|
3033
|
+
diffTurns: eff.turns
|
|
3034
|
+
},
|
|
3035
|
+
findings: scopedFindings
|
|
3036
|
+
};
|
|
3037
|
+
}
|
|
3038
|
+
|
|
2749
3039
|
// src/version.ts
|
|
2750
3040
|
import { readFileSync } from "fs";
|
|
2751
3041
|
import { fileURLToPath } from "url";
|
|
@@ -2935,7 +3225,14 @@ function finalAssistantText(sum) {
|
|
|
2935
3225
|
const gens = sum.spans.filter((s) => s.kind !== "session").sort((a, b) => a.startTime - b.startTime || a.spanId.localeCompare(b.spanId)).filter((s) => s.kind === "generation");
|
|
2936
3226
|
return gens[gens.length - 1]?.input || "";
|
|
2937
3227
|
}
|
|
2938
|
-
function
|
|
3228
|
+
function samePath(touched, scopeFile) {
|
|
3229
|
+
if (touched === scopeFile || touched.endsWith(`/${scopeFile}`) || scopeFile.endsWith(`/${touched}`)) {
|
|
3230
|
+
return true;
|
|
3231
|
+
}
|
|
3232
|
+
const tb = touched.split("/").pop();
|
|
3233
|
+
return !!tb && tb === scopeFile.split("/").pop();
|
|
3234
|
+
}
|
|
3235
|
+
function deriveEvidence(session, sum, scope) {
|
|
2939
3236
|
const tools = sum.spans.filter((s) => s.kind === "tool");
|
|
2940
3237
|
const edits = tools.filter((s) => isEditTool(s.name)).length;
|
|
2941
3238
|
const commandSpans = tools.filter((s) => isCommandTool(s.name));
|
|
@@ -2972,6 +3269,14 @@ function deriveEvidence(session, sum) {
|
|
|
2972
3269
|
finishReasons[s.finishReason] = (finishReasons[s.finishReason] ?? 0) + 1;
|
|
2973
3270
|
}
|
|
2974
3271
|
}
|
|
3272
|
+
let coveredFiles;
|
|
3273
|
+
if (scope?.kind === "diff" && scope.files?.length) {
|
|
3274
|
+
const touched = tools.filter((s) => isEditTool(s.name) || isReadTool(s.name)).map((s) => filePathOf(s.input)).filter((f) => !!f);
|
|
3275
|
+
const cmdTexts = commandSpans.map((s) => commandOf(s.input)).filter(Boolean);
|
|
3276
|
+
coveredFiles = scope.files.filter(
|
|
3277
|
+
(f) => touched.some((t) => samePath(t, f)) || cmdTexts.some((c) => commandMentionsFile(c, [f]))
|
|
3278
|
+
).length;
|
|
3279
|
+
}
|
|
2975
3280
|
const tk = session.totals.tokens;
|
|
2976
3281
|
return {
|
|
2977
3282
|
filesChanged: sum.filesChanged.length,
|
|
@@ -2979,9 +3284,12 @@ function deriveEvidence(session, sum) {
|
|
|
2979
3284
|
commands: commandSpans.length,
|
|
2980
3285
|
reads,
|
|
2981
3286
|
destructiveOps: sum.destructiveCount,
|
|
3287
|
+
...coveredFiles != null ? { coveredFiles } : {},
|
|
2982
3288
|
testsRan,
|
|
2983
3289
|
...sum.diffCostUsd != null ? {
|
|
2984
|
-
|
|
3290
|
+
// sub-cent costs keep 4dp — 2dp rounding recorded $0.004 work as $0.00
|
|
3291
|
+
// (field: every release receipt showed "$0.00 (this change)")
|
|
3292
|
+
diffCostUsd: round(sum.diffCostUsd, 2) || round(sum.diffCostUsd, 4),
|
|
2985
3293
|
diffTokens: sum.diffTokens ?? 0,
|
|
2986
3294
|
diffTurns: sum.diffTurns ?? 0
|
|
2987
3295
|
} : {},
|
|
@@ -2997,7 +3305,8 @@ function deriveEvidence(session, sum) {
|
|
|
2997
3305
|
reasoning: tk.reasoning,
|
|
2998
3306
|
total: tk.total
|
|
2999
3307
|
},
|
|
3000
|
-
|
|
3308
|
+
// same sub-cent fallback as diffCostUsd, so diff ≤ session always holds
|
|
3309
|
+
costUsd: round(sum.totalCost, 2) || round(sum.totalCost, 4),
|
|
3001
3310
|
cacheHitRatio: round(sum.cacheHitRatio, 4),
|
|
3002
3311
|
cacheWriteRatio: round(tk.cacheWrite / Math.max(1, tk.cacheRead), 4)
|
|
3003
3312
|
};
|
|
@@ -3015,7 +3324,7 @@ async function buildReceipt(session, derived, findings, opts = {}) {
|
|
|
3015
3324
|
durationMs: session.totals.durationMs
|
|
3016
3325
|
},
|
|
3017
3326
|
grade: gradeLetter(findings.main),
|
|
3018
|
-
evidence: deriveEvidence(session, derived),
|
|
3327
|
+
evidence: deriveEvidence(session, derived, opts.scope),
|
|
3019
3328
|
findings: [...findings.main, ...findings.minor].map(toReceiptFinding),
|
|
3020
3329
|
generator: {
|
|
3021
3330
|
name: "altimate-receipts",
|
|
@@ -3095,16 +3404,6 @@ var dur = (ms) => {
|
|
|
3095
3404
|
const h = Math.floor(m / 60);
|
|
3096
3405
|
return h ? `${h}h ${m % 60}m` : `${m}m`;
|
|
3097
3406
|
};
|
|
3098
|
-
function grade(c, main) {
|
|
3099
|
-
const meta = {
|
|
3100
|
-
F: { col: c.bgRed + c.white, verdict: "DO NOT MERGE WITHOUT REVIEW", icon: "\u26D4" },
|
|
3101
|
-
C: { col: c.bgYel + c.black, verdict: "NEEDS A CLOSE REVIEW", icon: "\u26A0\uFE0F " },
|
|
3102
|
-
B: { col: c.bgGrn + c.black, verdict: "MINOR THINGS TO CHECK", icon: "\u{1F50D}" },
|
|
3103
|
-
A: { col: c.bgGrn + c.white, verdict: "LOOKS CLEAN", icon: "\u2705" }
|
|
3104
|
-
};
|
|
3105
|
-
const g = gradeLetter(main);
|
|
3106
|
-
return { g, ...meta[g] };
|
|
3107
|
-
}
|
|
3108
3407
|
var sevIcon = (s) => ({ critical: "\u26D4", high: "\u26A0\uFE0F ", medium: "\u{1F50D}", low: "\xB7" })[s] ?? "\xB7";
|
|
3109
3408
|
var sevColOf = (c, s) => ({ critical: c.red, high: c.yel, medium: c.cyn, low: c.gray })[s] ?? c.gray;
|
|
3110
3409
|
var TEST_CMD2 = /\b(pytest|jest|vitest|npm (run )?test|yarn test|go test|cargo test|tsc|eslint|dbt (test|build)|mocha|rspec|phpunit|gradle test|mvn test)\b/i;
|
|
@@ -3117,10 +3416,9 @@ function renderCard(args, opts = {}) {
|
|
|
3117
3416
|
const line = (s = "") => ` ${s}`;
|
|
3118
3417
|
const rule = (ch = "\u2500") => line(c.gray + ch.repeat(W) + c.reset);
|
|
3119
3418
|
const tools = sum.spans.filter((s) => s.kind === "tool");
|
|
3120
|
-
const gd = grade(c, main);
|
|
3121
3419
|
const out = [];
|
|
3122
3420
|
out.push(`${c.cyn} \u2554${"\u2550".repeat(W)}\u2557${c.reset}`);
|
|
3123
|
-
const hdrLeft = ` ${c.bold}\u{1F9FE} RECEIPTS${c.reset}${c.dim} \u2014 Agent
|
|
3421
|
+
const hdrLeft = ` ${c.bold}\u{1F9FE} RECEIPTS${c.reset}${c.dim} \u2014 Agent Work Record${c.reset}`;
|
|
3124
3422
|
const hdrRight = `${c.mag}${c.bold}proof, not vibes ${c.reset}`;
|
|
3125
3423
|
out.push(
|
|
3126
3424
|
` ${c.cyn}\u2551${c.reset}${pad(hdrLeft, W - vlen(hdrRight))}${hdrRight}${c.cyn}\u2551${c.reset}`
|
|
@@ -3146,13 +3444,11 @@ function renderCard(args, opts = {}) {
|
|
|
3146
3444
|
)
|
|
3147
3445
|
);
|
|
3148
3446
|
out.push("");
|
|
3149
|
-
out.push(line(`${c.gray}\u250C\u2500
|
|
3150
|
-
const gradeInner = `${c.gray} ${c.reset}${gd.col}${c.bold} ${gd.g} ${c.reset} ${gd.icon} ${c.bold}${gd.verdict}${c.reset}`;
|
|
3151
|
-
out.push(line(`${c.gray}\u2502${c.reset}${pad(gradeInner, W)}${c.gray}\u2502${c.reset}`));
|
|
3447
|
+
out.push(line(`${c.gray}\u250C\u2500 RECORD ${"\u2500".repeat(W - 9)}\u2510${c.reset}`));
|
|
3152
3448
|
const counts = ["critical", "high", "medium"].map((s) => {
|
|
3153
3449
|
const n = main.filter((f) => f.severity === s).length;
|
|
3154
3450
|
return n ? `${sevColOf(c, s)}${n} ${s}${c.reset}` : null;
|
|
3155
|
-
}).filter(Boolean).join(`${c.gray} \xB7 ${c.reset}`) || `${c.
|
|
3451
|
+
}).filter(Boolean).join(`${c.gray} \xB7 ${c.reset}`) || `${c.gray}nothing detected${c.reset}`;
|
|
3156
3452
|
out.push(
|
|
3157
3453
|
line(`${c.gray}\u2502${c.reset} ${counts}${pad("", W - 1 - vlen(counts))}${c.gray}\u2502${c.reset}`)
|
|
3158
3454
|
);
|
|
@@ -3182,7 +3478,11 @@ function renderCard(args, opts = {}) {
|
|
|
3182
3478
|
out.push(line(`${c.gray} \u25B8 ${minor.length} minor (collapsed)${c.reset}`));
|
|
3183
3479
|
}
|
|
3184
3480
|
if (!sorted.length && !minor.length) {
|
|
3185
|
-
out.push(
|
|
3481
|
+
out.push(
|
|
3482
|
+
tools.length === 0 ? line(`${c.gray} no tool activity parsed for this session \u2014 nothing to report${c.reset}`) : line(
|
|
3483
|
+
`${c.gray} nothing detected ${c.dim}("not detected" means no flag \u2014 not that nothing exists)${c.reset}`
|
|
3484
|
+
)
|
|
3485
|
+
);
|
|
3186
3486
|
}
|
|
3187
3487
|
out.push("");
|
|
3188
3488
|
const cmds = tools.filter((s) => /bash|shell|exec|run|terminal/i.test(s.name));
|
|
@@ -4112,7 +4412,7 @@ import { homedir as homedir2 } from "os";
|
|
|
4112
4412
|
import { join as join2 } from "path";
|
|
4113
4413
|
|
|
4114
4414
|
// src/trace/sqlite.ts
|
|
4115
|
-
import { spawnSync } from "child_process";
|
|
4415
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
4116
4416
|
async function tryNodeSqlite(dbPath2) {
|
|
4117
4417
|
try {
|
|
4118
4418
|
const { DatabaseSync } = await import("sqlite");
|
|
@@ -4126,13 +4426,13 @@ async function tryNodeSqlite(dbPath2) {
|
|
|
4126
4426
|
}
|
|
4127
4427
|
}
|
|
4128
4428
|
function trySqlite3Cli(dbPath2) {
|
|
4129
|
-
const probe =
|
|
4429
|
+
const probe = spawnSync2("sqlite3", ["-version"], { encoding: "utf8" });
|
|
4130
4430
|
if (probe.error || probe.status !== 0) {
|
|
4131
4431
|
return null;
|
|
4132
4432
|
}
|
|
4133
4433
|
return {
|
|
4134
4434
|
all: (sql) => {
|
|
4135
|
-
const r =
|
|
4435
|
+
const r = spawnSync2("sqlite3", ["-readonly", "-json", dbPath2, sql], {
|
|
4136
4436
|
encoding: "utf8",
|
|
4137
4437
|
maxBuffer: 1 << 29
|
|
4138
4438
|
// bubbles can be large
|
|
@@ -4684,23 +4984,21 @@ function redactReceipt(receipt) {
|
|
|
4684
4984
|
}
|
|
4685
4985
|
|
|
4686
4986
|
export {
|
|
4687
|
-
estimateCost,
|
|
4688
|
-
isEditTool,
|
|
4689
|
-
filePathOf,
|
|
4690
|
-
commandOf,
|
|
4691
|
-
destructiveMatch,
|
|
4692
4987
|
deriveSpans,
|
|
4693
4988
|
cwdAtFirstGit,
|
|
4694
|
-
parseGitInvocations,
|
|
4695
|
-
isNoVerify,
|
|
4696
|
-
rewritesHistory,
|
|
4697
|
-
destroysGitData,
|
|
4698
|
-
touchedPaths,
|
|
4699
4989
|
formatTokens,
|
|
4700
4990
|
formatCostAlways,
|
|
4701
4991
|
deriveFindings,
|
|
4702
4992
|
gradeLetter,
|
|
4703
4993
|
renderLedger,
|
|
4994
|
+
privileged,
|
|
4995
|
+
findingSurface,
|
|
4996
|
+
destructiveOutsideRepo,
|
|
4997
|
+
changedFiles,
|
|
4998
|
+
inDiff,
|
|
4999
|
+
narrowEffort,
|
|
5000
|
+
windowedEffort,
|
|
5001
|
+
applyDiffScope,
|
|
4704
5002
|
getVersion,
|
|
4705
5003
|
hashTranscriptFile,
|
|
4706
5004
|
sha256Hex,
|
|
@@ -4730,4 +5028,4 @@ export {
|
|
|
4730
5028
|
redact,
|
|
4731
5029
|
redactReceipt
|
|
4732
5030
|
};
|
|
4733
|
-
//# sourceMappingURL=chunk-
|
|
5031
|
+
//# sourceMappingURL=chunk-TUWJRD7H.js.map
|