@codacy/verity-cli 0.29.4-experimental.9a4e14c → 0.29.4-experimental.f2e812c
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/bin/verity.js +209 -18
- package/package.json +1 -1
package/bin/verity.js
CHANGED
|
@@ -10390,11 +10390,11 @@ var MAX_DELTA_BYTES = 194560;
|
|
|
10390
10390
|
var MAX_FILES = 40;
|
|
10391
10391
|
var MAX_FILE_BYTES = 51200;
|
|
10392
10392
|
var DEBOUNCE_SECONDS = 30;
|
|
10393
|
-
var MAX_SPEC_FILES =
|
|
10394
|
-
var MAX_SPEC_FILE_BYTES =
|
|
10395
|
-
var MAX_TOTAL_SPEC_BYTES =
|
|
10393
|
+
var MAX_SPEC_FILES = 6;
|
|
10394
|
+
var MAX_SPEC_FILE_BYTES = 512e3;
|
|
10395
|
+
var MAX_TOTAL_SPEC_BYTES = 512e3;
|
|
10396
10396
|
var MAX_PLAN_FILES = 3;
|
|
10397
|
-
var MAX_PLAN_FILE_BYTES =
|
|
10397
|
+
var MAX_PLAN_FILE_BYTES = 512e3;
|
|
10398
10398
|
var MAX_INTENT_CHARS = 2e3;
|
|
10399
10399
|
var SNAPSHOT_DIR = `${VERITY_DIR}/.snapshot`;
|
|
10400
10400
|
var BASELINE_DIR = `${VERITY_DIR}/.baseline`;
|
|
@@ -16570,6 +16570,7 @@ function createRun(opts, globals) {
|
|
|
16570
16570
|
opts,
|
|
16571
16571
|
globals,
|
|
16572
16572
|
phaseReached: "",
|
|
16573
|
+
phasesCompleted: [],
|
|
16573
16574
|
skipReason: null,
|
|
16574
16575
|
turnId: "",
|
|
16575
16576
|
// The value `resolveReachability` itself returns when every rung declines.
|
|
@@ -16600,6 +16601,7 @@ function createRun(opts, globals) {
|
|
|
16600
16601
|
urlResult: { ok: false, error: "unresolved" },
|
|
16601
16602
|
serviceUrl: "",
|
|
16602
16603
|
token: "",
|
|
16604
|
+
modeDecision: null,
|
|
16603
16605
|
sessionIdForMemory: "",
|
|
16604
16606
|
contextFilePaths: [],
|
|
16605
16607
|
analysisMode: "standard",
|
|
@@ -16710,7 +16712,19 @@ function formatRunEvidence(run, startedAt) {
|
|
|
16710
16712
|
out += row("turn", `${run.turnId || "(unminted)"}${run.sessionId ? ` \xB7 session ${run.sessionId}` : ""}`);
|
|
16711
16713
|
out += row("reached", `${run.phaseReached || "(none)"}${run.skipReason ? ` \xB7 SKIPPED: ${run.skipReason}` : ""} \xB7 ${ms}ms`);
|
|
16712
16714
|
out += row("changed", `${run.changedUniverse.length} from git \xB7 analyzable ${run.analyzable.length} \xB7 reviewable ${run.reviewable.length} \xB7 security ${run.securityFiles.length} \xB7 forReview ${run.allForReview.length}`);
|
|
16713
|
-
|
|
16715
|
+
const done = (phase) => run.phasesCompleted.includes(phase);
|
|
16716
|
+
const ifDone = (phase, value) => done(phase) ? value : "?";
|
|
16717
|
+
const md = run.modeDecision;
|
|
16718
|
+
if (md) {
|
|
16719
|
+
const how = md.forced ? "forced by --mode" : `predicted=${md.predicted ?? "none"} \u2192 ${md.resolved}`;
|
|
16720
|
+
out += row("mode", `${md.resolved} \xB7 ${how} \xB7 authored=${md.authored ? "yes" : "no"} \xB7 investigated=${md.investigated ? "yes" : "no"}`);
|
|
16721
|
+
} else {
|
|
16722
|
+
out += row("mode", `? (this run stopped in ${run.phaseReached || "no phase"}, before the mode was decided)`);
|
|
16723
|
+
}
|
|
16724
|
+
out += row("signals", `baseline=${ifDone("bootstrap", run.baseline ? "yes" : "no")} \xB7 authored=${ifDone("intentInputs", run.turnAuthoredCode ? "yes" : "no")} \xB7 observable=${ifDone("intentInputs", run.authorshipIsObservable ? "yes" : "no")}` + (run.actionSummary?.transcript_windowed ? ` \xB7 window=${run.actionSummary.transcript_windowed}` : ""));
|
|
16725
|
+
if (!done("intentInputs")) {
|
|
16726
|
+
out += row("", `(\`?\` = the phase that determines it did not complete \u2014 this run stopped in ${run.phaseReached})`);
|
|
16727
|
+
}
|
|
16714
16728
|
out += row("sent", `${sent.length} \xB7 ${list(sent)}`);
|
|
16715
16729
|
if (context.length > 0) out += row("context", `${context.length} \xB7 ${list(context)}`);
|
|
16716
16730
|
const withheld = run.reviewCoverage.notReviewed;
|
|
@@ -16735,6 +16749,46 @@ function formatRunEvidence(run, startedAt) {
|
|
|
16735
16749
|
out += row("withheld", "(nothing \u2014 every changed file was reviewed)");
|
|
16736
16750
|
}
|
|
16737
16751
|
}
|
|
16752
|
+
const cov = run.foldResult?.coverage;
|
|
16753
|
+
if (cov) {
|
|
16754
|
+
const delegated = run.foldResult.authored.filter((a) => a.owner === "subagent").length;
|
|
16755
|
+
if (cov.dispatched > 0 || cov.subagentFiles > 0 || cov.subagentSkipped > 0) {
|
|
16756
|
+
out += row("delegated", `${cov.dispatched} dispatched \xB7 ${cov.subagentFiles} agent log(s) read \xB7 ${delegated} path(s) attributed to subagents`);
|
|
16757
|
+
}
|
|
16758
|
+
if (cov.subagentSkipped > 0) {
|
|
16759
|
+
out += row("", `\u26A0 ${cov.subagentSkipped} agent log(s) REFUSED by the byte budget \u2014 the authored set above is PARTIAL`);
|
|
16760
|
+
}
|
|
16761
|
+
if (cov.dispatched > 0 && cov.subagentFiles === 0) {
|
|
16762
|
+
out += row("", `\u26A0 this turn dispatched ${cov.dispatched} agent(s) but no agent log was found \u2014 delegated work is unattributed (has the transcript layout moved?)`);
|
|
16763
|
+
}
|
|
16764
|
+
if (cov.outsideRepo > 0) {
|
|
16765
|
+
out += row("", `${cov.outsideRepo} authored path(s) refused as outside the repo`);
|
|
16766
|
+
}
|
|
16767
|
+
}
|
|
16768
|
+
if (run.foldResult?.tools?.length) {
|
|
16769
|
+
const shown = run.foldResult.tools.slice(0, 6).map((t) => {
|
|
16770
|
+
const outcome = t.failed > 0 ? `${t.failed} failed` : t.last_status === 0 ? "ok" : "?";
|
|
16771
|
+
const where = t.targets.length > 0 ? ` \u2192 ${t.targets.slice(0, 2).join(", ")}` : "";
|
|
16772
|
+
return `${t.runs}\xD7 ${t.name} (${outcome})${where}`;
|
|
16773
|
+
});
|
|
16774
|
+
const more = run.foldResult.tools.length > 6 ? ` \u2026 +${run.foldResult.tools.length - 6} more` : "";
|
|
16775
|
+
out += row("tools", shown.join(" \xB7 ") + more);
|
|
16776
|
+
if (run.foldResult.coverage.toolNamesDropped > 0) {
|
|
16777
|
+
out += row("", `\u26A0 ${run.foldResult.coverage.toolNamesDropped} tool name(s) refused by the cap`);
|
|
16778
|
+
}
|
|
16779
|
+
}
|
|
16780
|
+
if (run.foldResult?.tasks?.length) {
|
|
16781
|
+
const t = run.foldResult.tasks;
|
|
16782
|
+
const done2 = t.filter((x) => x.status === "completed").length;
|
|
16783
|
+
out += row("tasks", `${t.length} \xB7 ${done2} completed \xB7 ` + list(t.slice(0, 4).map((x) => `#${x.id} ${x.name} [${x.status}]`), 4));
|
|
16784
|
+
}
|
|
16785
|
+
if (run.specs?.length) {
|
|
16786
|
+
const readThisSession = new Set(run.actionSummary?.files_read ?? []);
|
|
16787
|
+
const labelled = run.specs.map(
|
|
16788
|
+
(s) => `${s.path}${readThisSession.has(s.path) ? " (read)" : " (positional)"}`
|
|
16789
|
+
);
|
|
16790
|
+
out += row("specs", `${run.specs.length} \xB7 ${list(labelled, 5)}`);
|
|
16791
|
+
}
|
|
16738
16792
|
if (run.staticResults.findings.length > 0) {
|
|
16739
16793
|
out += row("static", `${run.staticResults.findings.length} finding(s) from ${run.staticResults.summary.tools_run.join(", ") || "no tools"}`);
|
|
16740
16794
|
}
|
|
@@ -16930,6 +16984,8 @@ function buildSummary(lines) {
|
|
|
16930
16984
|
break;
|
|
16931
16985
|
case "Agent":
|
|
16932
16986
|
case "Task":
|
|
16987
|
+
case "Workflow":
|
|
16988
|
+
case "SendMessage":
|
|
16933
16989
|
subagents++;
|
|
16934
16990
|
break;
|
|
16935
16991
|
case "WebFetch":
|
|
@@ -17184,7 +17240,7 @@ function channelSilence(input) {
|
|
|
17184
17240
|
// src/lib/cli-version.ts
|
|
17185
17241
|
function cliVersion() {
|
|
17186
17242
|
try {
|
|
17187
|
-
return true ? "0.29.4-experimental.
|
|
17243
|
+
return true ? "0.29.4-experimental.f2e812c" : "dev";
|
|
17188
17244
|
} catch {
|
|
17189
17245
|
return "dev";
|
|
17190
17246
|
}
|
|
@@ -17535,18 +17591,26 @@ var SPEC_CANDIDATES = [
|
|
|
17535
17591
|
"docs/API.md",
|
|
17536
17592
|
"spec/ARCHITECTURE.md"
|
|
17537
17593
|
];
|
|
17538
|
-
|
|
17594
|
+
var DOC_EXT = /\.(md|mdx|ya?ml|txt|rst|adoc)$/i;
|
|
17595
|
+
var UNCONSULTED_FILE_BYTES = 10240;
|
|
17596
|
+
var UNCONSULTED_TOTAL_BYTES = 30720;
|
|
17597
|
+
function discoverSpecs(consulted = []) {
|
|
17539
17598
|
const result = [];
|
|
17540
17599
|
const seen = /* @__PURE__ */ new Set();
|
|
17541
17600
|
let totalBytes = 0;
|
|
17542
|
-
const
|
|
17601
|
+
const consultedDocs = new Set(
|
|
17602
|
+
consulted.filter((p) => DOC_EXT.test(p) && !p.startsWith("/") && !p.includes(".."))
|
|
17603
|
+
);
|
|
17604
|
+
const addSpec = (specPath, relevant = false) => {
|
|
17543
17605
|
if (result.length >= MAX_SPEC_FILES) return false;
|
|
17544
|
-
|
|
17606
|
+
const totalCap = relevant ? MAX_TOTAL_SPEC_BYTES : UNCONSULTED_TOTAL_BYTES;
|
|
17607
|
+
if (totalBytes >= totalCap) return false;
|
|
17545
17608
|
if (seen.has(specPath)) return true;
|
|
17546
17609
|
if (!(0, import_node_fs21.existsSync)(specPath)) return true;
|
|
17547
17610
|
seen.add(specPath);
|
|
17548
|
-
const remaining =
|
|
17549
|
-
const
|
|
17611
|
+
const remaining = totalCap - totalBytes;
|
|
17612
|
+
const fileCap = relevant ? MAX_SPEC_FILE_BYTES : UNCONSULTED_FILE_BYTES;
|
|
17613
|
+
const readBytes = Math.min(fileCap, remaining);
|
|
17550
17614
|
try {
|
|
17551
17615
|
const buf = Buffer.alloc(readBytes);
|
|
17552
17616
|
const fd = (0, import_node_fs21.openSync)(specPath, "r");
|
|
@@ -17560,6 +17624,9 @@ function discoverSpecs() {
|
|
|
17560
17624
|
}
|
|
17561
17625
|
return true;
|
|
17562
17626
|
};
|
|
17627
|
+
for (const doc of consultedDocs) {
|
|
17628
|
+
if (!addSpec(doc, true)) break;
|
|
17629
|
+
}
|
|
17563
17630
|
for (const candidate of SPEC_CANDIDATES) {
|
|
17564
17631
|
if (!addSpec(candidate)) break;
|
|
17565
17632
|
}
|
|
@@ -17630,7 +17697,7 @@ function discoverPlans() {
|
|
|
17630
17697
|
async function intentInputs(run) {
|
|
17631
17698
|
const { actionSummary, allForReview, assistantResponse, baseline, baselineSessionId } = run;
|
|
17632
17699
|
const conversation = await readAndClearConversationBuffer(baselineSessionId);
|
|
17633
|
-
const specs = discoverSpecs();
|
|
17700
|
+
const specs = discoverSpecs(actionSummary?.files_read ?? []);
|
|
17634
17701
|
const plans = discoverPlans();
|
|
17635
17702
|
const agentAuthoredCodeThisTurn = !!(actionSummary && (actionSummary.files_edited.length > 0 || actionSummary.files_created.length > 0));
|
|
17636
17703
|
const turnAuthoredCode = agentAuthoredCodeThisTurn || !!baseline && allForReview.some((f) => changedSinceBaseline(f, baseline));
|
|
@@ -17853,7 +17920,8 @@ async function mode(run) {
|
|
|
17853
17920
|
let analysisMode;
|
|
17854
17921
|
const sessionAuthoredCode = !!baseline && allForReview.some((f) => changedSinceBaseline(f, baseline));
|
|
17855
17922
|
const modeOverride = opts.mode;
|
|
17856
|
-
|
|
17923
|
+
const forced = !!modeOverride && ["standard", "plan", "debug", "skip"].includes(modeOverride);
|
|
17924
|
+
if (forced) {
|
|
17857
17925
|
analysisMode = modeOverride;
|
|
17858
17926
|
} else {
|
|
17859
17927
|
analysisMode = reconcileAnalysisMode(
|
|
@@ -17861,6 +17929,25 @@ async function mode(run) {
|
|
|
17861
17929
|
{ noFilesChanged, assistantResponse, actionSummary, conversationPrompts, sessionAuthoredCode }
|
|
17862
17930
|
);
|
|
17863
17931
|
}
|
|
17932
|
+
const investigated = didAgentInvestigate(actionSummary);
|
|
17933
|
+
run.modeDecision = {
|
|
17934
|
+
predicted: predictedMode ?? null,
|
|
17935
|
+
resolved: analysisMode,
|
|
17936
|
+
authored: turnAuthoredCode,
|
|
17937
|
+
investigated,
|
|
17938
|
+
forced
|
|
17939
|
+
};
|
|
17940
|
+
logEvent("mode_resolved", {
|
|
17941
|
+
predicted: predictedMode ?? null,
|
|
17942
|
+
resolved: analysisMode,
|
|
17943
|
+
forced,
|
|
17944
|
+
authored: turnAuthoredCode,
|
|
17945
|
+
investigated,
|
|
17946
|
+
// The two counters that decide `investigated`, so a false reading is
|
|
17947
|
+
// traceable to the tool that was not recognised.
|
|
17948
|
+
subagents: actionSummary?.subagents ?? null,
|
|
17949
|
+
files_read: actionSummary?.files_read.length ?? null
|
|
17950
|
+
});
|
|
17864
17951
|
if (analysisMode === "skip") {
|
|
17865
17952
|
await passAndExit(
|
|
17866
17953
|
run,
|
|
@@ -18126,6 +18213,18 @@ function commandShape(cmd) {
|
|
|
18126
18213
|
return out.join(" ").slice(0, COMMAND_HEAD_CHARS);
|
|
18127
18214
|
}
|
|
18128
18215
|
var COMMAND_HEAD_CHARS = 80;
|
|
18216
|
+
var MAX_TOOL_NAMES = 64;
|
|
18217
|
+
var MAX_TOOL_TARGETS = 3;
|
|
18218
|
+
var MAX_TASKS = 64;
|
|
18219
|
+
var TASK_NAME_CHARS = 120;
|
|
18220
|
+
function toolTarget(name, input) {
|
|
18221
|
+
if (name === "Bash") return null;
|
|
18222
|
+
for (const key of ["file_path", "notebook_path", "path", "filePath"]) {
|
|
18223
|
+
const v = input[key];
|
|
18224
|
+
if (typeof v === "string" && v) return v.slice(0, 120);
|
|
18225
|
+
}
|
|
18226
|
+
return null;
|
|
18227
|
+
}
|
|
18129
18228
|
var rootCandidateCache = /* @__PURE__ */ new Map();
|
|
18130
18229
|
function candidateRoots(repoRoot2) {
|
|
18131
18230
|
const cached2 = rootCandidateCache.get(repoRoot2);
|
|
@@ -18154,17 +18253,30 @@ function toRepoRelative(path, repoRoot2) {
|
|
|
18154
18253
|
}
|
|
18155
18254
|
return p.replace(/^\/+/, "");
|
|
18156
18255
|
}
|
|
18256
|
+
function isInsideRepo(path, repoRoot2) {
|
|
18257
|
+
const p = path.replace(/\\/g, "/");
|
|
18258
|
+
if (!isAbsolutePath(p)) return true;
|
|
18259
|
+
if (!repoRoot2) return true;
|
|
18260
|
+
return candidateRoots(repoRoot2).some((root) => p === root || p.startsWith(root + "/"));
|
|
18261
|
+
}
|
|
18262
|
+
function isAbsolutePath(p) {
|
|
18263
|
+
return p.startsWith("/") || /^[A-Za-z]:\//.test(p);
|
|
18264
|
+
}
|
|
18157
18265
|
function fold(transcriptPath, opts = {}) {
|
|
18158
18266
|
const result = {
|
|
18159
18267
|
authored: [],
|
|
18160
18268
|
unobserved: [],
|
|
18161
18269
|
commands: [],
|
|
18270
|
+
tools: [],
|
|
18271
|
+
tasks: [],
|
|
18162
18272
|
unknownTypes: [],
|
|
18163
18273
|
coverage: {
|
|
18164
18274
|
recordCounts: {},
|
|
18165
18275
|
totalRecords: 0,
|
|
18166
18276
|
malformed: 0,
|
|
18167
18277
|
subagentFiles: 0,
|
|
18278
|
+
outsideRepo: 0,
|
|
18279
|
+
toolNamesDropped: 0,
|
|
18168
18280
|
dispatched: 0,
|
|
18169
18281
|
userMessages: 0,
|
|
18170
18282
|
subagentSkipped: 0,
|
|
@@ -18175,6 +18287,10 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18175
18287
|
const byPath = /* @__PURE__ */ new Map();
|
|
18176
18288
|
const commandStats = /* @__PURE__ */ new Map();
|
|
18177
18289
|
const pendingByToolUse = /* @__PURE__ */ new Map();
|
|
18290
|
+
const toolStats = /* @__PURE__ */ new Map();
|
|
18291
|
+
const pendingToolName = /* @__PURE__ */ new Map();
|
|
18292
|
+
const taskById = /* @__PURE__ */ new Map();
|
|
18293
|
+
const pendingTaskName = /* @__PURE__ */ new Map();
|
|
18178
18294
|
const unknown = /* @__PURE__ */ new Set();
|
|
18179
18295
|
const ingest = (raw, owner) => {
|
|
18180
18296
|
for (const line of raw.split("\n")) {
|
|
@@ -18194,7 +18310,7 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18194
18310
|
result.coverage.compactions++;
|
|
18195
18311
|
}
|
|
18196
18312
|
if (type === "user" && hasUserText(record)) result.coverage.userMessages++;
|
|
18197
|
-
collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, opts.repoRoot, result.coverage);
|
|
18313
|
+
collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, toolStats, pendingToolName, taskById, pendingTaskName, opts.repoRoot, result.coverage);
|
|
18198
18314
|
}
|
|
18199
18315
|
};
|
|
18200
18316
|
try {
|
|
@@ -18205,7 +18321,11 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18205
18321
|
return result;
|
|
18206
18322
|
}
|
|
18207
18323
|
try {
|
|
18208
|
-
const sidecarDir = (0, import_node_path18.join)(
|
|
18324
|
+
const sidecarDir = (0, import_node_path18.join)(
|
|
18325
|
+
(0, import_node_path18.dirname)(transcriptPath),
|
|
18326
|
+
(0, import_node_path18.basename)(transcriptPath).replace(/\.jsonl$/, ""),
|
|
18327
|
+
"subagents"
|
|
18328
|
+
);
|
|
18209
18329
|
if ((0, import_node_fs23.existsSync)(sidecarDir)) {
|
|
18210
18330
|
const maxFiles = opts.maxSidecars ?? 200;
|
|
18211
18331
|
const maxBytes = opts.maxSidecarBytes ?? 16 * 1024 * 1024;
|
|
@@ -18248,6 +18368,14 @@ function fold(transcriptPath, opts = {}) {
|
|
|
18248
18368
|
result.authored = [...byPath.values()].sort((a, b) => a.p.localeCompare(b.p));
|
|
18249
18369
|
result.unknownTypes = [...unknown].sort();
|
|
18250
18370
|
result.commands = [...commandStats.entries()].map(([cls, s]) => ({ class: cls, ...s })).sort((a, b) => a.class.localeCompare(b.class));
|
|
18371
|
+
result.tools = [...toolStats.entries()].map(([name, s]) => ({
|
|
18372
|
+
name,
|
|
18373
|
+
runs: s.runs,
|
|
18374
|
+
failed: s.failed,
|
|
18375
|
+
last_status: s.last_status,
|
|
18376
|
+
targets: [...s.targets].map((t) => toRepoRelative(t, opts.repoRoot)).sort()
|
|
18377
|
+
})).sort((a, b) => b.runs - a.runs || a.name.localeCompare(b.name));
|
|
18378
|
+
result.tasks = [...taskById.entries()].map(([id, t]) => ({ id, name: t.name, status: t.status })).sort((a, b) => (Number(a.id) || 0) - (Number(b.id) || 0));
|
|
18251
18379
|
const authoredPaths = new Set(result.authored.map((a) => a.p));
|
|
18252
18380
|
for (const raw of opts.changedFiles ?? []) {
|
|
18253
18381
|
const p = toRepoRelative(raw, opts.repoRoot);
|
|
@@ -18266,7 +18394,7 @@ function classifyUnobserved(path) {
|
|
|
18266
18394
|
if (/\.(png|jpg|jpeg|gif|pdf|zip|woff2?|ico|mp4)$/i.test(path)) return "binary";
|
|
18267
18395
|
return "no_edit_record";
|
|
18268
18396
|
}
|
|
18269
|
-
function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, repoRoot2, tally) {
|
|
18397
|
+
function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse, toolStats, pendingToolName, taskById, pendingTaskName, repoRoot2, tally) {
|
|
18270
18398
|
const message = record.message;
|
|
18271
18399
|
const content = message?.content ?? record.content;
|
|
18272
18400
|
const blocks = Array.isArray(content) ? content : content && typeof content === "object" ? [content] : [];
|
|
@@ -18275,8 +18403,38 @@ function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse
|
|
|
18275
18403
|
if (blockType === "tool_use") {
|
|
18276
18404
|
const name = String(block.name ?? "");
|
|
18277
18405
|
const input = block.input ?? {};
|
|
18406
|
+
if (name && toolStats.size < MAX_TOOL_NAMES) {
|
|
18407
|
+
const prev = toolStats.get(name) ?? { runs: 0, failed: 0, last_status: null, targets: /* @__PURE__ */ new Set() };
|
|
18408
|
+
prev.targets = prev.targets ?? /* @__PURE__ */ new Set();
|
|
18409
|
+
if (prev.targets.size < MAX_TOOL_TARGETS) {
|
|
18410
|
+
const target = toolTarget(name, input);
|
|
18411
|
+
if (target) prev.targets.add(target);
|
|
18412
|
+
}
|
|
18413
|
+
toolStats.set(name, { runs: prev.runs + 1, failed: prev.failed, last_status: null, targets: prev.targets });
|
|
18414
|
+
const toolId = typeof block.id === "string" ? block.id : null;
|
|
18415
|
+
if (toolId) pendingToolName.set(toolId, name);
|
|
18416
|
+
} else if (name && tally) {
|
|
18417
|
+
tally.toolNamesDropped += 1;
|
|
18418
|
+
}
|
|
18419
|
+
if (name === "TaskCreate") {
|
|
18420
|
+
const subject = typeof input.subject === "string" ? input.subject : "";
|
|
18421
|
+
const taskId = typeof block.id === "string" ? block.id : null;
|
|
18422
|
+
if (subject && taskId) pendingTaskName.set(taskId, subject.slice(0, TASK_NAME_CHARS));
|
|
18423
|
+
}
|
|
18424
|
+
if (name === "TaskUpdate") {
|
|
18425
|
+
const id = typeof input.taskId === "string" ? input.taskId : "";
|
|
18426
|
+
const status = typeof input.status === "string" ? input.status : "";
|
|
18427
|
+
if (id && status) {
|
|
18428
|
+
const entry = taskById.get(id);
|
|
18429
|
+
taskById.set(id, { name: entry?.name ?? `#${id}`, status });
|
|
18430
|
+
}
|
|
18431
|
+
}
|
|
18278
18432
|
if (EDIT_TOOLS.has(name)) {
|
|
18279
18433
|
const rawPath = typeof input.notebook_path === "string" ? input.notebook_path : typeof input.file_path === "string" ? input.file_path : null;
|
|
18434
|
+
if (rawPath && !isInsideRepo(rawPath, repoRoot2)) {
|
|
18435
|
+
if (tally) tally.outsideRepo += 1;
|
|
18436
|
+
continue;
|
|
18437
|
+
}
|
|
18280
18438
|
const path = rawPath ? toRepoRelative(rawPath, repoRoot2) : null;
|
|
18281
18439
|
if (path) {
|
|
18282
18440
|
const entry = byPath.get(path) ?? { p: path, h: 0, a: 0, d: 0, owner };
|
|
@@ -18310,6 +18468,31 @@ function collectFromRecord(record, owner, byPath, commandStats, pendingByToolUse
|
|
|
18310
18468
|
}
|
|
18311
18469
|
if (blockType === "tool_result") {
|
|
18312
18470
|
const id = typeof block.tool_use_id === "string" ? block.tool_use_id : null;
|
|
18471
|
+
const taskName = id ? pendingTaskName.get(id) : void 0;
|
|
18472
|
+
if (taskName) {
|
|
18473
|
+
pendingTaskName.delete(id);
|
|
18474
|
+
const body = typeof block.content === "string" ? block.content : "";
|
|
18475
|
+
const created = /Task #(\d+)/.exec(body);
|
|
18476
|
+
if (created && taskById.size < MAX_TASKS) {
|
|
18477
|
+
taskById.set(created[1], { name: taskName, status: taskById.get(created[1])?.status ?? "created" });
|
|
18478
|
+
}
|
|
18479
|
+
}
|
|
18480
|
+
const toolName = id ? pendingToolName.get(id) : void 0;
|
|
18481
|
+
if (toolName) {
|
|
18482
|
+
pendingToolName.delete(id);
|
|
18483
|
+
const prevTool = toolStats.get(toolName);
|
|
18484
|
+
if (prevTool) {
|
|
18485
|
+
const failed = block.is_error === true;
|
|
18486
|
+
toolStats.set(toolName, {
|
|
18487
|
+
runs: prevTool.runs,
|
|
18488
|
+
failed: prevTool.failed + (failed ? 1 : 0),
|
|
18489
|
+
last_status: block.is_error === true ? 1 : block.is_error === false ? 0 : null,
|
|
18490
|
+
// Carried, not rebuilt: the targets were collected on the `tool_use`
|
|
18491
|
+
// side and dropping them here would empty the ledger on every result.
|
|
18492
|
+
targets: prevTool.targets
|
|
18493
|
+
});
|
|
18494
|
+
}
|
|
18495
|
+
}
|
|
18313
18496
|
const cls = id ? pendingByToolUse.get(id) : void 0;
|
|
18314
18497
|
if (!cls) continue;
|
|
18315
18498
|
pendingByToolUse.delete(id);
|
|
@@ -18529,6 +18712,10 @@ function gatherContextFiles(contextPaths, deltaFiles) {
|
|
|
18529
18712
|
for (const filePath of contextPaths) {
|
|
18530
18713
|
if (result.length >= MAX_CONTEXT_FILES) break;
|
|
18531
18714
|
if (deltaPaths.has(filePath)) continue;
|
|
18715
|
+
if (isVerityOwnedPath(filePath)) {
|
|
18716
|
+
logEvent("context_file_skipped", { path: filePath, reason: "verity_owned" });
|
|
18717
|
+
continue;
|
|
18718
|
+
}
|
|
18532
18719
|
try {
|
|
18533
18720
|
const content = (0, import_node_fs25.readFileSync)(filePath, "utf8");
|
|
18534
18721
|
const bytes = Buffer.byteLength(content);
|
|
@@ -19299,6 +19486,8 @@ async function buildRequest(run) {
|
|
|
19299
19486
|
authored_since_verdict: memorySession ? foldDossier(memorySession.d).authored_all.filter((a) => a.hash_now !== a.hash_at_last_verdict).map((a) => a.path) : [],
|
|
19300
19487
|
unobserved: foldResult?.unobserved ?? [],
|
|
19301
19488
|
commands: foldResult?.commands ?? [],
|
|
19489
|
+
tools: foldResult?.tools ?? [],
|
|
19490
|
+
tasks: foldResult?.tasks ?? [],
|
|
19302
19491
|
unknown_types: foldResult?.unknownTypes ?? [],
|
|
19303
19492
|
coverage: foldResult?.coverage ?? { recordCounts: {}, totalRecords: 0, malformed: 0, subagentFiles: 0, subagentSkipped: 0, complete: false },
|
|
19304
19493
|
// INV-19, computed client-side and sent so a conservation failure is
|
|
@@ -20123,10 +20312,12 @@ async function runAnalyze(opts, globals) {
|
|
|
20123
20312
|
run.phaseReached = name;
|
|
20124
20313
|
if (!tracing()) {
|
|
20125
20314
|
await phase(run);
|
|
20315
|
+
run.phasesCompleted.push(name);
|
|
20126
20316
|
continue;
|
|
20127
20317
|
}
|
|
20128
20318
|
const started = Date.now();
|
|
20129
20319
|
await phase(run);
|
|
20320
|
+
run.phasesCompleted.push(name);
|
|
20130
20321
|
process.stderr.write(`verity\xB7phase ${name} ${Date.now() - started}ms
|
|
20131
20322
|
`);
|
|
20132
20323
|
}
|
|
@@ -21923,8 +22114,8 @@ function registerTelemetryCommands(program2) {
|
|
|
21923
22114
|
}
|
|
21924
22115
|
|
|
21925
22116
|
// src/cli.ts
|
|
21926
|
-
program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.
|
|
21927
|
-
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.
|
|
22117
|
+
program.name("verity").description("CLI for Verity quality gate service").version("0.29.4-experimental.f2e812c").option("--token <token>", "Override authentication token").option("--service-url <url>", "Override service URL").option("--verbose", "Log HTTP requests/responses to stderr").hook("preAction", async (_thisCommand, actionCommand) => {
|
|
22118
|
+
installStderrLog(actionCommand.name(), process.argv.slice(2), "0.29.4-experimental.f2e812c");
|
|
21928
22119
|
setUserNamedServiceUrl(program.opts().serviceUrl);
|
|
21929
22120
|
try {
|
|
21930
22121
|
await foldLegacyLocalCredential();
|
package/package.json
CHANGED