nexus-agents 2.140.2 → 2.141.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/dist/{chunk-66LTZALB.js → chunk-4VCLI2T3.js} +692 -436
- package/dist/chunk-4VCLI2T3.js.map +1 -0
- package/dist/{chunk-FLDT5YWH.js → chunk-7XOTLM3R.js} +3 -3
- package/dist/{chunk-JO2EX53W.js → chunk-VLODTBPY.js} +2 -2
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +53 -0
- package/dist/index.js +2 -2
- package/dist/{setup-command-SR7SNTMD.js → setup-command-SP3Q6YW6.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-66LTZALB.js.map +0 -1
- /package/dist/{chunk-FLDT5YWH.js.map → chunk-7XOTLM3R.js.map} +0 -0
- /package/dist/{chunk-JO2EX53W.js.map → chunk-VLODTBPY.js.map} +0 -0
- /package/dist/{setup-command-SR7SNTMD.js.map → setup-command-SP3Q6YW6.js.map} +0 -0
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
DEFAULT_TASK_TTL_MS,
|
|
19
19
|
DEFAULT_TOOL_RATE_LIMITS,
|
|
20
20
|
clampTaskTtl
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-7XOTLM3R.js";
|
|
22
22
|
import {
|
|
23
23
|
executeExpert
|
|
24
24
|
} from "./chunk-733ZGAXH.js";
|
|
@@ -265,6 +265,7 @@ import {
|
|
|
265
265
|
isPersistenceEnabled
|
|
266
266
|
} from "./chunk-NL7SZQPW.js";
|
|
267
267
|
import {
|
|
268
|
+
findRepoRoot,
|
|
268
269
|
nexusDataPath,
|
|
269
270
|
nexusDataPathEnsure
|
|
270
271
|
} from "./chunk-DHVMSIT5.js";
|
|
@@ -43928,7 +43929,7 @@ function createAuditStageRegistry() {
|
|
|
43928
43929
|
}
|
|
43929
43930
|
|
|
43930
43931
|
// src/mcp/tools/pr-review-tool.ts
|
|
43931
|
-
import { z as
|
|
43932
|
+
import { z as z91 } from "zod";
|
|
43932
43933
|
import { randomUUID as randomUUID13 } from "crypto";
|
|
43933
43934
|
|
|
43934
43935
|
// src/mcp/tools/pr-review-findings.ts
|
|
@@ -44011,6 +44012,312 @@ var FINDINGS_FORMAT_INSTRUCTIONS = `If you have one or more findings (claims tha
|
|
|
44011
44012
|
|
|
44012
44013
|
A finding only triggers request_changes if ALL FOUR gate checks are 'passed' AND named_assertion is substantive (>10 chars, naming a concrete failure). Findings missing any of those surface as informational only \u2014 they do not block the merge. This is the #2225 verification gate; the 2026-04-25 audit found a 100% false-positive rate when this gate was not enforced.`;
|
|
44013
44014
|
|
|
44015
|
+
// src/audit/reviewed-diff-hash.ts
|
|
44016
|
+
import * as crypto2 from "crypto";
|
|
44017
|
+
var MAX_REVIEWED_DIFF_BYTES = 5e4;
|
|
44018
|
+
var CANONICAL_GIT_DIFF_ARGS = Object.freeze([
|
|
44019
|
+
"-c",
|
|
44020
|
+
"core.autocrlf=false",
|
|
44021
|
+
"-c",
|
|
44022
|
+
"diff.algorithm=myers",
|
|
44023
|
+
"-c",
|
|
44024
|
+
"diff.mnemonicprefix=false",
|
|
44025
|
+
"-c",
|
|
44026
|
+
"diff.noprefix=false",
|
|
44027
|
+
"diff",
|
|
44028
|
+
"--no-color",
|
|
44029
|
+
"--no-ext-diff",
|
|
44030
|
+
"--no-renames",
|
|
44031
|
+
"-U3"
|
|
44032
|
+
]);
|
|
44033
|
+
function computeReviewedDiffHash(diff) {
|
|
44034
|
+
const bytes = Buffer.from(diff, "utf-8");
|
|
44035
|
+
const truncated = bytes.byteLength > MAX_REVIEWED_DIFF_BYTES ? bytes.subarray(0, MAX_REVIEWED_DIFF_BYTES) : bytes;
|
|
44036
|
+
return crypto2.createHash("sha256").update(truncated).digest("hex");
|
|
44037
|
+
}
|
|
44038
|
+
function reviewedDiffWasTruncated(diff) {
|
|
44039
|
+
return Buffer.byteLength(diff, "utf-8") > MAX_REVIEWED_DIFF_BYTES;
|
|
44040
|
+
}
|
|
44041
|
+
|
|
44042
|
+
// src/audit/pr-review-record-store.ts
|
|
44043
|
+
import { appendFileSync as appendFileSync4, existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync7 } from "fs";
|
|
44044
|
+
import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve12 } from "path";
|
|
44045
|
+
|
|
44046
|
+
// src/audit/pr-review-record.ts
|
|
44047
|
+
import * as crypto3 from "crypto";
|
|
44048
|
+
import { z as z90 } from "zod";
|
|
44049
|
+
var PrReviewVerdictSchema = z90.enum(["approve", "request_changes", "abstain"]);
|
|
44050
|
+
var PrReviewVoteCountsSchema = z90.object({
|
|
44051
|
+
approve: z90.number().int().nonnegative(),
|
|
44052
|
+
request_changes: z90.number().int().nonnegative(),
|
|
44053
|
+
abstain: z90.number().int().nonnegative(),
|
|
44054
|
+
error: z90.number().int().nonnegative(),
|
|
44055
|
+
total: z90.number().int().nonnegative()
|
|
44056
|
+
}).strict();
|
|
44057
|
+
var PrReviewRecordSchema = z90.object({
|
|
44058
|
+
/**
|
|
44059
|
+
* Schema version. '1.1' is the Option-C binding (#3831): the record binds to
|
|
44060
|
+
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
44061
|
+
* Clean break — the committed `governance/pr-review-records.jsonl` ledger is
|
|
44062
|
+
* empty on every install (no producer ever wrote a '1.0' record), so there is
|
|
44063
|
+
* no '1.0' data to migrate.
|
|
44064
|
+
*/
|
|
44065
|
+
version: z90.literal("1.1"),
|
|
44066
|
+
/**
|
|
44067
|
+
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
44068
|
+
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
44069
|
+
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
44070
|
+
* benign concurrent-fork signal, not tampering.
|
|
44071
|
+
*/
|
|
44072
|
+
sequence: z90.number().int().nonnegative(),
|
|
44073
|
+
/** The PR number the review covers. */
|
|
44074
|
+
prNumber: z90.number().int().positive(),
|
|
44075
|
+
/**
|
|
44076
|
+
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
44077
|
+
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
44078
|
+
* which range to recompute {@link reviewedDiffHash} over.
|
|
44079
|
+
*/
|
|
44080
|
+
baseSha: z90.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
44081
|
+
/**
|
|
44082
|
+
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
44083
|
+
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
44084
|
+
* byte-truncation). The gate recomputes this from the committed PR's diff and
|
|
44085
|
+
* matches it, so a record only satisfies a PR whose reviewed diff is
|
|
44086
|
+
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
44087
|
+
* cannot be edited to claim a different reviewed diff.
|
|
44088
|
+
*/
|
|
44089
|
+
reviewedDiffHash: z90.string().length(64),
|
|
44090
|
+
/** ISO-8601 timestamp the review was recorded. */
|
|
44091
|
+
recordedAt: z90.string().min(1),
|
|
44092
|
+
/** The resolved aggregate verdict. */
|
|
44093
|
+
verdict: PrReviewVerdictSchema,
|
|
44094
|
+
/**
|
|
44095
|
+
* Whether the aggregate carried a VERIFIED finding (the 4-point gate). A
|
|
44096
|
+
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
44097
|
+
* hash so it cannot be flipped without detection.
|
|
44098
|
+
*/
|
|
44099
|
+
verified: z90.boolean(),
|
|
44100
|
+
/** Per-decision voter tally from the pr_review aggregate. */
|
|
44101
|
+
voteCounts: PrReviewVoteCountsSchema,
|
|
44102
|
+
/** Truncated human-readable review summary for the reviewer record. */
|
|
44103
|
+
summary: z90.string(),
|
|
44104
|
+
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
44105
|
+
correlationId: z90.string().min(1).optional(),
|
|
44106
|
+
/**
|
|
44107
|
+
* ADVISORY hash of the tip record at write time (absent for the first).
|
|
44108
|
+
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
44109
|
+
* the record-set model is position-independent (mirrors #3927).
|
|
44110
|
+
*/
|
|
44111
|
+
previousHash: z90.string().length(64).optional(),
|
|
44112
|
+
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
44113
|
+
hash: z90.string().length(64)
|
|
44114
|
+
}).strict();
|
|
44115
|
+
function computePrReviewRecordHash(payload) {
|
|
44116
|
+
const canonical = JSON.stringify({
|
|
44117
|
+
version: payload.version,
|
|
44118
|
+
sequence: payload.sequence,
|
|
44119
|
+
prNumber: payload.prNumber,
|
|
44120
|
+
baseSha: payload.baseSha,
|
|
44121
|
+
reviewedDiffHash: payload.reviewedDiffHash,
|
|
44122
|
+
recordedAt: payload.recordedAt,
|
|
44123
|
+
verdict: payload.verdict,
|
|
44124
|
+
verified: payload.verified,
|
|
44125
|
+
// Rebuild voteCounts in schema order so the hash does not depend on how the
|
|
44126
|
+
// nested object's keys were ordered (mirrors #3962).
|
|
44127
|
+
voteCounts: {
|
|
44128
|
+
approve: payload.voteCounts.approve,
|
|
44129
|
+
request_changes: payload.voteCounts.request_changes,
|
|
44130
|
+
abstain: payload.voteCounts.abstain,
|
|
44131
|
+
error: payload.voteCounts.error,
|
|
44132
|
+
total: payload.voteCounts.total
|
|
44133
|
+
},
|
|
44134
|
+
summary: payload.summary,
|
|
44135
|
+
correlationId: payload.correlationId ?? null
|
|
44136
|
+
});
|
|
44137
|
+
return crypto3.createHash("sha256").update(canonical).digest("hex");
|
|
44138
|
+
}
|
|
44139
|
+
|
|
44140
|
+
// src/audit/pr-review-record-store.ts
|
|
44141
|
+
var PR_REVIEW_RECORDS_REL_PATH = "governance/pr-review-records.jsonl";
|
|
44142
|
+
var PR_REVIEW_RECORDS_PATH_ENV = "NEXUS_PR_REVIEW_RECORDS_PATH";
|
|
44143
|
+
var MAX_SUMMARY_RECORD_CHARS = 500;
|
|
44144
|
+
function buildPrReviewRecord(input) {
|
|
44145
|
+
const summaryTruncated = input.summary.length > MAX_SUMMARY_RECORD_CHARS ? input.summary.slice(0, MAX_SUMMARY_RECORD_CHARS) + "..." : input.summary;
|
|
44146
|
+
const payload = {
|
|
44147
|
+
version: "1.1",
|
|
44148
|
+
sequence: input.sequence ?? 0,
|
|
44149
|
+
prNumber: input.prNumber,
|
|
44150
|
+
baseSha: input.baseSha,
|
|
44151
|
+
reviewedDiffHash: input.reviewedDiffHash,
|
|
44152
|
+
recordedAt: input.recordedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
44153
|
+
verdict: input.verdict,
|
|
44154
|
+
verified: input.verified,
|
|
44155
|
+
voteCounts: {
|
|
44156
|
+
approve: input.voteCounts.approve,
|
|
44157
|
+
request_changes: input.voteCounts.request_changes,
|
|
44158
|
+
abstain: input.voteCounts.abstain,
|
|
44159
|
+
error: input.voteCounts.error,
|
|
44160
|
+
total: input.voteCounts.total
|
|
44161
|
+
},
|
|
44162
|
+
summary: summaryTruncated,
|
|
44163
|
+
...input.correlationId !== void 0 ? { correlationId: input.correlationId } : {},
|
|
44164
|
+
...input.previousHash !== void 0 ? { previousHash: input.previousHash } : {}
|
|
44165
|
+
};
|
|
44166
|
+
return { ...payload, hash: computePrReviewRecordHash(payload) };
|
|
44167
|
+
}
|
|
44168
|
+
function resolvePrReviewRecordsPath() {
|
|
44169
|
+
const envPath = process.env[PR_REVIEW_RECORDS_PATH_ENV];
|
|
44170
|
+
if (envPath !== void 0 && envPath.trim() !== "") {
|
|
44171
|
+
return isAbsolute(envPath) ? envPath : resolve12(envPath);
|
|
44172
|
+
}
|
|
44173
|
+
const root = findRepoRoot(process.cwd());
|
|
44174
|
+
if (root === null) return void 0;
|
|
44175
|
+
return join9(root, PR_REVIEW_RECORDS_REL_PATH);
|
|
44176
|
+
}
|
|
44177
|
+
function readPrReviewRecords(filePath) {
|
|
44178
|
+
const records = [];
|
|
44179
|
+
const invalidLines = [];
|
|
44180
|
+
if (!existsSync9(filePath)) return { records, invalidLines };
|
|
44181
|
+
const lines = readFileSync7(filePath, "utf-8").split("\n").filter((l) => l.trim() !== "");
|
|
44182
|
+
for (const [i, line] of lines.entries()) {
|
|
44183
|
+
try {
|
|
44184
|
+
const parsed = PrReviewRecordSchema.safeParse(JSON.parse(line));
|
|
44185
|
+
if (parsed.success) records.push(parsed.data);
|
|
44186
|
+
else invalidLines.push(i + 1);
|
|
44187
|
+
} catch {
|
|
44188
|
+
invalidLines.push(i + 1);
|
|
44189
|
+
}
|
|
44190
|
+
}
|
|
44191
|
+
return { records, invalidLines };
|
|
44192
|
+
}
|
|
44193
|
+
function readPrReviewLedgerTip(filePath, logger57) {
|
|
44194
|
+
if (!existsSync9(filePath)) return { maxSequence: -1, lastHash: void 0 };
|
|
44195
|
+
try {
|
|
44196
|
+
const { records } = readPrReviewRecords(filePath);
|
|
44197
|
+
if (records.length === 0) return { maxSequence: -1, lastHash: void 0 };
|
|
44198
|
+
let maxSequence = -1;
|
|
44199
|
+
for (const record of records) {
|
|
44200
|
+
if (record.sequence > maxSequence) maxSequence = record.sequence;
|
|
44201
|
+
}
|
|
44202
|
+
const last = records[records.length - 1];
|
|
44203
|
+
return { maxSequence, lastHash: last?.hash };
|
|
44204
|
+
} catch (error) {
|
|
44205
|
+
logger57.warn("Failed to read pr-review-record ledger tip", { error: getErrorMessage(error) });
|
|
44206
|
+
return { maxSequence: -1, lastHash: void 0 };
|
|
44207
|
+
}
|
|
44208
|
+
}
|
|
44209
|
+
function persistPrReviewRecord(opts) {
|
|
44210
|
+
const logger57 = opts.logger ?? createLogger({ component: "pr-review-record-store" });
|
|
44211
|
+
const filePath = opts.filePath ?? resolvePrReviewRecordsPath();
|
|
44212
|
+
if (filePath === void 0) {
|
|
44213
|
+
logger57.warn("Cannot persist pr-review record: no records path resolved", {
|
|
44214
|
+
prNumber: opts.prNumber
|
|
44215
|
+
});
|
|
44216
|
+
return void 0;
|
|
44217
|
+
}
|
|
44218
|
+
try {
|
|
44219
|
+
mkdirSync6(dirname4(filePath), { recursive: true });
|
|
44220
|
+
const { maxSequence, lastHash } = readPrReviewLedgerTip(filePath, logger57);
|
|
44221
|
+
const record = buildPrReviewRecord({
|
|
44222
|
+
...opts,
|
|
44223
|
+
sequence: maxSequence + 1,
|
|
44224
|
+
previousHash: lastHash
|
|
44225
|
+
});
|
|
44226
|
+
appendFileSync4(filePath, JSON.stringify(record) + "\n", "utf-8");
|
|
44227
|
+
logger57.info("Persisted authentic pr-review record", {
|
|
44228
|
+
prNumber: record.prNumber,
|
|
44229
|
+
verdict: record.verdict,
|
|
44230
|
+
sequence: record.sequence,
|
|
44231
|
+
path: filePath
|
|
44232
|
+
});
|
|
44233
|
+
return record;
|
|
44234
|
+
} catch (error) {
|
|
44235
|
+
logger57.warn("Failed to persist authentic pr-review record", {
|
|
44236
|
+
error: getErrorMessage(error),
|
|
44237
|
+
prNumber: opts.prNumber,
|
|
44238
|
+
path: filePath
|
|
44239
|
+
});
|
|
44240
|
+
return void 0;
|
|
44241
|
+
}
|
|
44242
|
+
}
|
|
44243
|
+
|
|
44244
|
+
// src/mcp/tools/pr-review-record-producer.ts
|
|
44245
|
+
function buildAndPersist(prNumber, baseSha, args) {
|
|
44246
|
+
const { input, aggregate, counts, reviewCount, logger: logger57 } = args;
|
|
44247
|
+
if (reviewedDiffWasTruncated(input.prDiff)) {
|
|
44248
|
+
logger57.warn(
|
|
44249
|
+
"Reviewed diff exceeds the hash byte cap; content past it is unbound in reviewedDiffHash",
|
|
44250
|
+
{ prNumber }
|
|
44251
|
+
);
|
|
44252
|
+
}
|
|
44253
|
+
const record = persistPrReviewRecord({
|
|
44254
|
+
prNumber,
|
|
44255
|
+
baseSha,
|
|
44256
|
+
reviewedDiffHash: computeReviewedDiffHash(input.prDiff),
|
|
44257
|
+
verdict: aggregate.decision,
|
|
44258
|
+
verified: aggregate.verified,
|
|
44259
|
+
voteCounts: {
|
|
44260
|
+
approve: counts.approveCount,
|
|
44261
|
+
request_changes: counts.requestChangesCount,
|
|
44262
|
+
abstain: counts.abstainCount,
|
|
44263
|
+
error: counts.errorCount,
|
|
44264
|
+
total: reviewCount
|
|
44265
|
+
},
|
|
44266
|
+
summary: `${aggregate.decision} (${String(counts.approveCount)} approve / ${String(counts.requestChangesCount)} request_changes / ${String(counts.abstainCount)} abstain) \u2014 ${input.prTitle}`,
|
|
44267
|
+
logger: logger57
|
|
44268
|
+
});
|
|
44269
|
+
if (record === void 0) {
|
|
44270
|
+
return {
|
|
44271
|
+
persisted: false,
|
|
44272
|
+
reason: "write-failed",
|
|
44273
|
+
detail: "Audit record could not be written: the records path was unresolved or the append failed (see server logs for the underlying cause)."
|
|
44274
|
+
};
|
|
44275
|
+
}
|
|
44276
|
+
return {
|
|
44277
|
+
persisted: true,
|
|
44278
|
+
prNumber: record.prNumber,
|
|
44279
|
+
baseSha: record.baseSha,
|
|
44280
|
+
reviewedDiffHash: record.reviewedDiffHash,
|
|
44281
|
+
sequence: record.sequence
|
|
44282
|
+
};
|
|
44283
|
+
}
|
|
44284
|
+
function persistReviewRecord(args) {
|
|
44285
|
+
const { input } = args;
|
|
44286
|
+
if (input.prNumber === void 0 || input.baseSha === void 0) {
|
|
44287
|
+
return {
|
|
44288
|
+
persisted: false,
|
|
44289
|
+
reason: "binding-inputs-absent",
|
|
44290
|
+
detail: "No audit record written: supply both prNumber and baseSha to persist an Option-C governor-review record bound to {prNumber, baseSha, reviewedDiffHash}."
|
|
44291
|
+
};
|
|
44292
|
+
}
|
|
44293
|
+
if (input.simulate) {
|
|
44294
|
+
return {
|
|
44295
|
+
persisted: false,
|
|
44296
|
+
reason: "simulated",
|
|
44297
|
+
detail: "No audit record written: the review used simulated voters, and a committed governance record must not be seeded from non-live output (mirrors #2319)."
|
|
44298
|
+
};
|
|
44299
|
+
}
|
|
44300
|
+
const { counts } = args;
|
|
44301
|
+
if (counts.approveCount + counts.requestChangesCount + counts.abstainCount === 0) {
|
|
44302
|
+
return {
|
|
44303
|
+
persisted: false,
|
|
44304
|
+
reason: "no-live-votes",
|
|
44305
|
+
detail: "No audit record written: every voter errored, so the aggregate verdict reflects no live review. A committed governor-review record must not be seeded from a failed panel (the pr_review analogue of no_quorum, #4053)."
|
|
44306
|
+
};
|
|
44307
|
+
}
|
|
44308
|
+
try {
|
|
44309
|
+
return buildAndPersist(input.prNumber, input.baseSha, args);
|
|
44310
|
+
} catch (error) {
|
|
44311
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
44312
|
+
args.logger.warn("Audit-record persistence threw (non-fatal)", { detail });
|
|
44313
|
+
return {
|
|
44314
|
+
persisted: false,
|
|
44315
|
+
reason: "write-failed",
|
|
44316
|
+
detail: `Audit record persistence raised: ${detail}`
|
|
44317
|
+
};
|
|
44318
|
+
}
|
|
44319
|
+
}
|
|
44320
|
+
|
|
44014
44321
|
// src/mcp/tools/pr-review-tool.ts
|
|
44015
44322
|
var PR_REVIEW_ROLES = [
|
|
44016
44323
|
"architect",
|
|
@@ -44022,14 +44329,29 @@ var PR_REVIEW_ROLES = [
|
|
|
44022
44329
|
var MAX_DIFF_LENGTH = 5e4;
|
|
44023
44330
|
var MAX_DESCRIPTION_LENGTH = 1e4;
|
|
44024
44331
|
var PR_REVIEW_ASYNC_HINT = "A pr_review run fans out to 5 live LLM voters and can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
44025
|
-
var PrReviewInputSchema =
|
|
44026
|
-
prTitle:
|
|
44027
|
-
prDescription:
|
|
44028
|
-
prDiff:
|
|
44029
|
-
repoContext:
|
|
44030
|
-
baseRef:
|
|
44031
|
-
headRef:
|
|
44032
|
-
|
|
44332
|
+
var PrReviewInputSchema = z91.object({
|
|
44333
|
+
prTitle: z91.string().min(1).max(500).describe("PR title"),
|
|
44334
|
+
prDescription: z91.string().max(MAX_DESCRIPTION_LENGTH).optional().describe("PR body / description"),
|
|
44335
|
+
prDiff: z91.string().min(1).max(MAX_DIFF_LENGTH).describe(`Unified diff text (max ${String(MAX_DIFF_LENGTH)} chars; truncate before calling)`),
|
|
44336
|
+
repoContext: z91.string().max(2e3).optional().describe("Optional one-paragraph repo context (architecture, conventions)"),
|
|
44337
|
+
baseRef: z91.string().max(200).optional().describe("Base branch ref (e.g. main)"),
|
|
44338
|
+
headRef: z91.string().max(200).optional().describe("Head branch ref"),
|
|
44339
|
+
/**
|
|
44340
|
+
* Option-C audit binding (#4031). When BOTH `prNumber` and `baseSha` are
|
|
44341
|
+
* supplied AND the review is live (not simulated), pr_review persists an
|
|
44342
|
+
* authentic, self-hashed pr-review record binding {prNumber, baseSha,
|
|
44343
|
+
* reviewedDiffHash(prDiff), verdict} to the governance ledger — the record the
|
|
44344
|
+
* warn-first governor-review gate (#3831) queries. Omit either to skip
|
|
44345
|
+
* persistence (a structured `recordOutcome` note explains why). IMPORTANT: for
|
|
44346
|
+
* the gate to FIND the record, `prDiff`'s first 50_000 bytes must match the
|
|
44347
|
+
* canonical `git diff <baseSha>..<headSha>` the gate recomputes (the hash
|
|
44348
|
+
* truncates at that byte cap) — pass the canonical diff, not a reordered one.
|
|
44349
|
+
*/
|
|
44350
|
+
prNumber: z91.number().int().positive().optional().describe("PR number \u2014 with baseSha, enables Option-C audit-record persistence (#4031)"),
|
|
44351
|
+
baseSha: z91.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha").optional().describe(
|
|
44352
|
+
"40-hex base commit sha the reviewed diff was computed from (Option-C binding, #4031)"
|
|
44353
|
+
),
|
|
44354
|
+
simulate: z91.boolean().default(false).describe("Use simulated voters (testing only; never ship live with this true)"),
|
|
44033
44355
|
/**
|
|
44034
44356
|
* Dispatch mode (#3731). `sync` (default) runs the 5-voter panel inline and
|
|
44035
44357
|
* returns the result — but a live fan-out can exceed the MCP request timeout.
|
|
@@ -44037,7 +44359,7 @@ var PrReviewInputSchema = z90.object({
|
|
|
44037
44359
|
* runs the panel in the background; poll `get_job_result({ jobId })` for the
|
|
44038
44360
|
* result.
|
|
44039
44361
|
*/
|
|
44040
|
-
dispatch:
|
|
44362
|
+
dispatch: z91.enum(["sync", "async"]).default("sync").describe(
|
|
44041
44363
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
44042
44364
|
)
|
|
44043
44365
|
});
|
|
@@ -44171,13 +44493,21 @@ async function executePrReviewBody(input, logger57, gatewayAdapters) {
|
|
|
44171
44493
|
error: getErrorMessage(costError)
|
|
44172
44494
|
});
|
|
44173
44495
|
}
|
|
44496
|
+
const recordOutcome3 = persistReviewRecord({
|
|
44497
|
+
input,
|
|
44498
|
+
aggregate,
|
|
44499
|
+
counts,
|
|
44500
|
+
reviewCount: reviews.length,
|
|
44501
|
+
logger: logger57
|
|
44502
|
+
});
|
|
44174
44503
|
const response = {
|
|
44175
44504
|
summary: aggregate.decision,
|
|
44176
44505
|
verified: aggregate.verified,
|
|
44177
44506
|
...counts,
|
|
44178
44507
|
reviews,
|
|
44179
44508
|
totalDurationMs: Date.now() - start,
|
|
44180
|
-
...costSummary !== void 0 ? { costSummary } : {}
|
|
44509
|
+
...costSummary !== void 0 ? { costSummary } : {},
|
|
44510
|
+
recordOutcome: recordOutcome3
|
|
44181
44511
|
};
|
|
44182
44512
|
return toolSuccess(JSON.stringify(response, null, 2));
|
|
44183
44513
|
}
|
|
@@ -44233,27 +44563,27 @@ function registerPrReviewTool(server, deps) {
|
|
|
44233
44563
|
}
|
|
44234
44564
|
|
|
44235
44565
|
// src/mcp/tools/survey-oss-landscape.ts
|
|
44236
|
-
import { z as
|
|
44237
|
-
var SurveyOssLandscapeInputSchema =
|
|
44238
|
-
query:
|
|
44239
|
-
maxResults:
|
|
44240
|
-
minStars:
|
|
44241
|
-
language:
|
|
44566
|
+
import { z as z92 } from "zod";
|
|
44567
|
+
var SurveyOssLandscapeInputSchema = z92.object({
|
|
44568
|
+
query: z92.string().min(1).max(200).describe('Free-text search query, e.g. "cargo nextest replacement" or "OSS SBOM tools"'),
|
|
44569
|
+
maxResults: z92.number().int().min(1).max(50).optional().default(10).describe("Maximum candidates to return (1-50; default 10)"),
|
|
44570
|
+
minStars: z92.number().int().min(0).optional().default(0).describe("Minimum star count to include (default 0; useful for filtering noise)"),
|
|
44571
|
+
language: z92.string().max(50).optional().describe('GitHub language filter, e.g. "rust" or "typescript"')
|
|
44242
44572
|
});
|
|
44243
|
-
var GitHubRepoSchema =
|
|
44244
|
-
full_name:
|
|
44245
|
-
html_url:
|
|
44246
|
-
description:
|
|
44247
|
-
stargazers_count:
|
|
44248
|
-
pushed_at:
|
|
44249
|
-
language:
|
|
44250
|
-
license:
|
|
44251
|
-
spdx_id:
|
|
44573
|
+
var GitHubRepoSchema = z92.object({
|
|
44574
|
+
full_name: z92.string().optional(),
|
|
44575
|
+
html_url: z92.string().optional(),
|
|
44576
|
+
description: z92.string().nullable().optional(),
|
|
44577
|
+
stargazers_count: z92.number().optional(),
|
|
44578
|
+
pushed_at: z92.string().nullable().optional(),
|
|
44579
|
+
language: z92.string().nullable().optional(),
|
|
44580
|
+
license: z92.object({
|
|
44581
|
+
spdx_id: z92.string().nullable().optional()
|
|
44252
44582
|
}).nullable().optional()
|
|
44253
44583
|
});
|
|
44254
|
-
var GitHubSearchResponseSchema =
|
|
44255
|
-
total_count:
|
|
44256
|
-
items:
|
|
44584
|
+
var GitHubSearchResponseSchema = z92.object({
|
|
44585
|
+
total_count: z92.number().optional(),
|
|
44586
|
+
items: z92.array(GitHubRepoSchema).optional()
|
|
44257
44587
|
});
|
|
44258
44588
|
var GITHUB_SEARCH_BASE = "https://api.github.com/search/repositories";
|
|
44259
44589
|
function buildGithubQuery(input) {
|
|
@@ -44380,11 +44710,11 @@ function createSurveyHandler(deps) {
|
|
|
44380
44710
|
};
|
|
44381
44711
|
}
|
|
44382
44712
|
var SURVEY_OUTPUT_SCHEMA = {
|
|
44383
|
-
query:
|
|
44384
|
-
totalFound:
|
|
44385
|
-
candidates:
|
|
44386
|
-
sourcesQueried:
|
|
44387
|
-
sourcesFailed:
|
|
44713
|
+
query: z92.string(),
|
|
44714
|
+
totalFound: z92.number(),
|
|
44715
|
+
candidates: z92.array(z92.unknown()),
|
|
44716
|
+
sourcesQueried: z92.array(z92.string()),
|
|
44717
|
+
sourcesFailed: z92.array(z92.string())
|
|
44388
44718
|
};
|
|
44389
44719
|
var SURVEY_DESCRIPTION = 'Transient OSS project search. Returns a ranked list of GitHub repositories with license, last-commit, star-count, and one-line description. Does NOT persist to the research registry \u2014 use `research_add_source` for that. Best for one-off engineering decisions like "what tools exist in this space?".';
|
|
44390
44720
|
function registerSurveyOssLandscapeTool(server, deps) {
|
|
@@ -44413,7 +44743,7 @@ function registerSurveyOssLandscapeTool(server, deps) {
|
|
|
44413
44743
|
}
|
|
44414
44744
|
|
|
44415
44745
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
44416
|
-
import { z as
|
|
44746
|
+
import { z as z93 } from "zod";
|
|
44417
44747
|
|
|
44418
44748
|
// src/mcp/tools/vendor-publishing-seed.ts
|
|
44419
44749
|
var VENDOR_PUBLISHING_SEED = {
|
|
@@ -44486,8 +44816,8 @@ function listKnownVendors() {
|
|
|
44486
44816
|
}
|
|
44487
44817
|
|
|
44488
44818
|
// src/mcp/tools/vendor-publishing-audit.ts
|
|
44489
|
-
var VendorPublishingAuditInputSchema =
|
|
44490
|
-
vendor:
|
|
44819
|
+
var VendorPublishingAuditInputSchema = z93.object({
|
|
44820
|
+
vendor: z93.string().min(1).max(50).toLowerCase().describe('Vendor identifier, lowercase. e.g. "ubuntu", "debian", "fedora"')
|
|
44491
44821
|
});
|
|
44492
44822
|
function lookupVendor(vendor) {
|
|
44493
44823
|
if (isKnownVendor(vendor)) {
|
|
@@ -44519,20 +44849,20 @@ function createVendorPublishingAuditHandler(deps) {
|
|
|
44519
44849
|
};
|
|
44520
44850
|
}
|
|
44521
44851
|
var VENDOR_PUBLISHING_OUTPUT_SCHEMA = {
|
|
44522
|
-
vendor:
|
|
44523
|
-
known:
|
|
44852
|
+
vendor: z93.string(),
|
|
44853
|
+
known: z93.boolean(),
|
|
44524
44854
|
// Fields below populate when known=true; permissive optional for known=false.
|
|
44525
|
-
sha256SumsUrlPattern:
|
|
44526
|
-
sha256SumsSignatureUrlPattern:
|
|
44527
|
-
signaturePattern:
|
|
44528
|
-
gpgKeys:
|
|
44529
|
-
releaseCadence:
|
|
44530
|
-
keyRotationNotes:
|
|
44531
|
-
vendorDocUrl:
|
|
44532
|
-
citedAt:
|
|
44855
|
+
sha256SumsUrlPattern: z93.string().optional(),
|
|
44856
|
+
sha256SumsSignatureUrlPattern: z93.string().optional(),
|
|
44857
|
+
signaturePattern: z93.string().optional(),
|
|
44858
|
+
gpgKeys: z93.array(z93.unknown()).optional(),
|
|
44859
|
+
releaseCadence: z93.string().optional(),
|
|
44860
|
+
keyRotationNotes: z93.string().optional(),
|
|
44861
|
+
vendorDocUrl: z93.string().optional(),
|
|
44862
|
+
citedAt: z93.string().optional(),
|
|
44533
44863
|
// Fields below populate when known=false.
|
|
44534
|
-
message:
|
|
44535
|
-
knownVendors:
|
|
44864
|
+
message: z93.string().optional(),
|
|
44865
|
+
knownVendors: z93.array(z93.string()).optional()
|
|
44536
44866
|
};
|
|
44537
44867
|
var VENDOR_PUBLISHING_DESCRIPTION = "Look up a vendor's published-artifact signing infrastructure: GPG key fingerprints, SHA256SUMS URL pattern, signature shape (clearsigned / detached / detached-on-iso), release cadence, key rotation notes, and the vendor doc citation. Static lookup against a curated seed dataset; the vendor doc URL is the authoritative source. Returns `{known: false, knownVendors: [...]}` for vendors without a seed entry. v1 covers ubuntu, debian, fedora.";
|
|
44538
44868
|
function registerVendorPublishingAuditTool(server, deps) {
|
|
@@ -44561,17 +44891,17 @@ function registerVendorPublishingAuditTool(server, deps) {
|
|
|
44561
44891
|
}
|
|
44562
44892
|
|
|
44563
44893
|
// src/mcp/tools/compare-data-feeds.ts
|
|
44564
|
-
import { z as
|
|
44894
|
+
import { z as z94 } from "zod";
|
|
44565
44895
|
import * as path7 from "path";
|
|
44566
44896
|
import * as fs8 from "fs";
|
|
44567
44897
|
import * as yaml2 from "yaml";
|
|
44568
|
-
var CompareDataFeedsInputSchema =
|
|
44569
|
-
feedAPath:
|
|
44570
|
-
feedBPath:
|
|
44571
|
-
keyPath:
|
|
44898
|
+
var CompareDataFeedsInputSchema = z94.object({
|
|
44899
|
+
feedAPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed A (YAML or JSON, auto-detected by extension)"),
|
|
44900
|
+
feedBPath: z94.string().min(1).max(1e3).describe("Filesystem path to feed B"),
|
|
44901
|
+
keyPath: z94.string().min(1).max(200).describe(
|
|
44572
44902
|
'Dotted path to the entry key, e.g. "id" or "name". Each entry must have this field.'
|
|
44573
44903
|
),
|
|
44574
|
-
compareFields:
|
|
44904
|
+
compareFields: z94.array(z94.string().min(1).max(200)).max(20).optional().describe(
|
|
44575
44905
|
'Optional dotted field paths to compare across matched entries (e.g. ["license", "sha256"])'
|
|
44576
44906
|
)
|
|
44577
44907
|
});
|
|
@@ -44755,24 +45085,24 @@ function createCompareDataFeedsHandler(deps) {
|
|
|
44755
45085
|
};
|
|
44756
45086
|
}
|
|
44757
45087
|
var COMPARE_OUTPUT_SCHEMA = {
|
|
44758
|
-
feedAPath:
|
|
44759
|
-
feedBPath:
|
|
44760
|
-
keyPath:
|
|
44761
|
-
counts:
|
|
44762
|
-
entriesInA:
|
|
44763
|
-
entriesInB:
|
|
44764
|
-
onlyInA:
|
|
44765
|
-
onlyInB:
|
|
44766
|
-
inBoth:
|
|
44767
|
-
fieldDifferences:
|
|
45088
|
+
feedAPath: z94.string(),
|
|
45089
|
+
feedBPath: z94.string(),
|
|
45090
|
+
keyPath: z94.string(),
|
|
45091
|
+
counts: z94.object({
|
|
45092
|
+
entriesInA: z94.number(),
|
|
45093
|
+
entriesInB: z94.number(),
|
|
45094
|
+
onlyInA: z94.number(),
|
|
45095
|
+
onlyInB: z94.number(),
|
|
45096
|
+
inBoth: z94.number(),
|
|
45097
|
+
fieldDifferences: z94.number()
|
|
44768
45098
|
}),
|
|
44769
|
-
coverage:
|
|
44770
|
-
onlyInA:
|
|
44771
|
-
onlyInB:
|
|
44772
|
-
inBoth:
|
|
45099
|
+
coverage: z94.object({
|
|
45100
|
+
onlyInA: z94.array(z94.string()),
|
|
45101
|
+
onlyInB: z94.array(z94.string()),
|
|
45102
|
+
inBoth: z94.array(z94.string())
|
|
44773
45103
|
}),
|
|
44774
|
-
fieldDifferences:
|
|
44775
|
-
summary:
|
|
45104
|
+
fieldDifferences: z94.array(z94.unknown()),
|
|
45105
|
+
summary: z94.string()
|
|
44776
45106
|
};
|
|
44777
45107
|
var COMPARE_DESCRIPTION = "Diff two upstream data feeds (YAML or JSON files) along coverage and per-field axes. Returns which entries exist in A, B, both, plus optional field-level diffs across matched entries. v1 takes file paths only (no URL fetch \u2014 that needs an SSRF design pass). Both feeds must be a top-level array OR a top-level object with exactly one array field.";
|
|
44778
45108
|
function registerCompareDataFeedsTool(server, deps) {
|
|
@@ -44801,9 +45131,9 @@ function registerCompareDataFeedsTool(server, deps) {
|
|
|
44801
45131
|
}
|
|
44802
45132
|
|
|
44803
45133
|
// src/mcp/tools/query-task-state-tool.ts
|
|
44804
|
-
import { z as
|
|
44805
|
-
var QueryTaskStateInputSchema =
|
|
44806
|
-
taskId:
|
|
45134
|
+
import { z as z95 } from "zod";
|
|
45135
|
+
var QueryTaskStateInputSchema = z95.object({
|
|
45136
|
+
taskId: z95.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
44807
45137
|
});
|
|
44808
45138
|
function queryTaskStateHandler(args, ctx) {
|
|
44809
45139
|
const parsed = QueryTaskStateInputSchema.safeParse(args);
|
|
@@ -44838,7 +45168,7 @@ function queryTaskStateHandler(args, ctx) {
|
|
|
44838
45168
|
function registerQueryTaskStateTool(server, deps) {
|
|
44839
45169
|
const logger57 = deps.logger ?? createLogger({ tool: "query_task_state" });
|
|
44840
45170
|
const toolSchema = {
|
|
44841
|
-
taskId:
|
|
45171
|
+
taskId: z95.string().min(1).max(128).describe("Task ID whose structured state log should be read")
|
|
44842
45172
|
};
|
|
44843
45173
|
const description = "Read the structured state log for a task ID and return the current snapshot. Includes Magentic-One Task Ledger (facts/guesses/openQuestions) and Progress Ledger (per-step reflections with suggestedAction) when orchestrators have written them. Structured state is only written when NEXUS_TASK_STATE_ENABLED=1 was set during the orchestrate invocation.";
|
|
44844
45174
|
const secureHandler = createSecureHandler(queryTaskStateHandler, {
|
|
@@ -44860,28 +45190,28 @@ function registerQueryTaskStateTool(server, deps) {
|
|
|
44860
45190
|
}
|
|
44861
45191
|
|
|
44862
45192
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
44863
|
-
import { z as
|
|
45193
|
+
import { z as z98 } from "zod";
|
|
44864
45194
|
|
|
44865
45195
|
// src/mcp/tools/ci-health-log.ts
|
|
44866
|
-
import { appendFileSync as
|
|
44867
|
-
import { z as
|
|
45196
|
+
import { appendFileSync as appendFileSync5, existsSync as existsSync11, readFileSync as readFileSync9, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
45197
|
+
import { z as z97 } from "zod";
|
|
44868
45198
|
|
|
44869
45199
|
// src/mcp/tools/ci-health-types.ts
|
|
44870
|
-
import { z as
|
|
44871
|
-
var CiHealthStatusSchema =
|
|
45200
|
+
import { z as z96 } from "zod";
|
|
45201
|
+
var CiHealthStatusSchema = z96.enum(["healthy", "degraded", "outage", "unknown"]);
|
|
44872
45202
|
|
|
44873
45203
|
// src/mcp/tools/ci-health-log.ts
|
|
44874
45204
|
var logger45 = createLogger({ component: "ci-health-log" });
|
|
44875
|
-
var CiHealthEventSchema =
|
|
44876
|
-
v:
|
|
44877
|
-
ts:
|
|
45205
|
+
var CiHealthEventSchema = z97.object({
|
|
45206
|
+
v: z97.literal(1),
|
|
45207
|
+
ts: z97.iso.datetime(),
|
|
44878
45208
|
status: CiHealthStatusSchema,
|
|
44879
|
-
repo:
|
|
44880
|
-
signals:
|
|
44881
|
-
|
|
44882
|
-
source:
|
|
45209
|
+
repo: z97.string().optional(),
|
|
45210
|
+
signals: z97.array(
|
|
45211
|
+
z97.object({
|
|
45212
|
+
source: z97.enum(["github-status", "repo-activity-window"]),
|
|
44883
45213
|
status: CiHealthStatusSchema,
|
|
44884
|
-
evidence:
|
|
45214
|
+
evidence: z97.string()
|
|
44885
45215
|
})
|
|
44886
45216
|
)
|
|
44887
45217
|
});
|
|
@@ -44905,7 +45235,7 @@ function capLogSize(path12) {
|
|
|
44905
45235
|
}
|
|
44906
45236
|
if (size <= max) return;
|
|
44907
45237
|
try {
|
|
44908
|
-
const lines =
|
|
45238
|
+
const lines = readFileSync9(path12, "utf-8").split("\n").filter((l) => l !== "");
|
|
44909
45239
|
const kept = [];
|
|
44910
45240
|
let bytes = 0;
|
|
44911
45241
|
for (let i = lines.length - 1; i >= 0; i--) {
|
|
@@ -44939,7 +45269,7 @@ function appendCiHealthEvent(event) {
|
|
|
44939
45269
|
};
|
|
44940
45270
|
try {
|
|
44941
45271
|
const path12 = logFilePath();
|
|
44942
|
-
|
|
45272
|
+
appendFileSync5(path12, `${JSON.stringify(record)}
|
|
44943
45273
|
`);
|
|
44944
45274
|
capLogSize(path12);
|
|
44945
45275
|
} catch (err2) {
|
|
@@ -44961,17 +45291,17 @@ function eventFromCheck(params) {
|
|
|
44961
45291
|
}
|
|
44962
45292
|
|
|
44963
45293
|
// src/mcp/tools/ci-health-check-tool.ts
|
|
44964
|
-
var CiHealthCheckInputSchema =
|
|
45294
|
+
var CiHealthCheckInputSchema = z98.object({
|
|
44965
45295
|
/**
|
|
44966
45296
|
* Repo to check for the recent-runs activity signal (in `owner/repo` form).
|
|
44967
45297
|
* Optional — when omitted, only the status-page signal is consulted.
|
|
44968
45298
|
*/
|
|
44969
|
-
repo:
|
|
45299
|
+
repo: z98.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
44970
45300
|
/**
|
|
44971
45301
|
* How far back to look for recent-runs activity (minutes). Default 30 —
|
|
44972
45302
|
* matches the typical wedge-detection window from the #3070 / #3076 outages.
|
|
44973
45303
|
*/
|
|
44974
|
-
activityWindowMinutes:
|
|
45304
|
+
activityWindowMinutes: z98.number().int().min(5).max(180).default(30).describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
44975
45305
|
});
|
|
44976
45306
|
var STATUS_PAGE_URL = "https://www.githubstatus.com/api/v2/components.json";
|
|
44977
45307
|
function mapStatusPageStatus(raw) {
|
|
@@ -45104,8 +45434,8 @@ var DESCRIPTION = "Check CI infrastructure health before triggering / polling ru
|
|
|
45104
45434
|
function registerCiHealthCheckTool(server, deps) {
|
|
45105
45435
|
const logger57 = deps.logger ?? createLogger({ tool: "ci_health_check" });
|
|
45106
45436
|
const toolSchema = {
|
|
45107
|
-
repo:
|
|
45108
|
-
activityWindowMinutes:
|
|
45437
|
+
repo: z98.string().regex(/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/, "Must be owner/repo form").optional().describe("GitHub repo (owner/repo) to check for recent CI activity. Optional."),
|
|
45438
|
+
activityWindowMinutes: z98.number().int().min(5).max(180).optional().describe("Recent-runs lookback window in minutes (5-180; default 30).")
|
|
45109
45439
|
};
|
|
45110
45440
|
const secureHandler = createSecureHandler((args) => ciHealthCheckHandler(args, logger57), {
|
|
45111
45441
|
toolName: "ci_health_check",
|
|
@@ -45131,18 +45461,18 @@ function registerCiHealthCheckTool(server, deps) {
|
|
|
45131
45461
|
|
|
45132
45462
|
// src/mcp/tools/quality-gate-tool.ts
|
|
45133
45463
|
import { statSync as statSync3 } from "fs";
|
|
45134
|
-
import { z as
|
|
45135
|
-
var QualityCheckSchema =
|
|
45464
|
+
import { z as z99 } from "zod";
|
|
45465
|
+
var QualityCheckSchema = z99.enum(["typecheck", "lint", "tests", "build", "security"]);
|
|
45136
45466
|
var DEFAULT_CHECKS = ["typecheck", "lint", "tests"];
|
|
45137
|
-
var RunQualityGateInputSchema =
|
|
45467
|
+
var RunQualityGateInputSchema = z99.object({
|
|
45138
45468
|
/** Project directory to run checks against. Must resolve inside the repo/cwd root. */
|
|
45139
|
-
projectDir:
|
|
45469
|
+
projectDir: z99.string().optional().describe(
|
|
45140
45470
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45141
45471
|
),
|
|
45142
45472
|
/** Which allowlisted checks to run. */
|
|
45143
|
-
checks:
|
|
45473
|
+
checks: z99.array(QualityCheckSchema).nonempty().default([...DEFAULT_CHECKS]).describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
45144
45474
|
/** 1-based iteration counter, forwarded to the engine for feedback context. */
|
|
45145
|
-
iteration:
|
|
45475
|
+
iteration: z99.number().int().min(1).default(1).describe("1-based iteration number (default 1).")
|
|
45146
45476
|
});
|
|
45147
45477
|
function validateProjectDir(raw) {
|
|
45148
45478
|
const candidate = raw ?? process.cwd();
|
|
@@ -45217,11 +45547,11 @@ var DESCRIPTION2 = "Run the QA quality gate (#1684 engine) against a project dir
|
|
|
45217
45547
|
function registerRunQualityGateTool(server, deps) {
|
|
45218
45548
|
const logger57 = deps.logger ?? createLogger({ tool: "run_quality_gate" });
|
|
45219
45549
|
const toolSchema = {
|
|
45220
|
-
projectDir:
|
|
45550
|
+
projectDir: z99.string().optional().describe(
|
|
45221
45551
|
"Project directory to run checks against (default: cwd). Must stay inside the repo root."
|
|
45222
45552
|
),
|
|
45223
|
-
checks:
|
|
45224
|
-
iteration:
|
|
45553
|
+
checks: z99.array(QualityCheckSchema).nonempty().optional().describe("Allowlisted checks to run (default: ['typecheck','lint','tests'])."),
|
|
45554
|
+
iteration: z99.number().int().min(1).optional().describe("1-based iteration number (default 1).")
|
|
45225
45555
|
};
|
|
45226
45556
|
const secureHandler = createSecureHandler(
|
|
45227
45557
|
(args) => runQualityGateHandler(args, logger57),
|
|
@@ -45251,9 +45581,9 @@ function registerRunQualityGateTool(server, deps) {
|
|
|
45251
45581
|
// src/mcp/tools/verify-audit-chain-tool.ts
|
|
45252
45582
|
import * as fs9 from "fs/promises";
|
|
45253
45583
|
import * as path8 from "path";
|
|
45254
|
-
import { z as
|
|
45255
|
-
var VerifyAuditChainInputSchema =
|
|
45256
|
-
logDir:
|
|
45584
|
+
import { z as z100 } from "zod";
|
|
45585
|
+
var VerifyAuditChainInputSchema = z100.object({
|
|
45586
|
+
logDir: z100.string().min(1).max(512).describe(
|
|
45257
45587
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files in lexicographic order and verifies the combined chain."
|
|
45258
45588
|
)
|
|
45259
45589
|
});
|
|
@@ -45330,7 +45660,7 @@ async function handler2(args, ctx) {
|
|
|
45330
45660
|
function registerVerifyAuditChainTool(server, deps) {
|
|
45331
45661
|
const logger57 = deps.logger ?? createLogger({ tool: "verify_audit_chain" });
|
|
45332
45662
|
const toolSchema = {
|
|
45333
|
-
logDir:
|
|
45663
|
+
logDir: z100.string().min(1).max(512).describe(
|
|
45334
45664
|
"Filesystem path to the FileAuditStorage log directory. Tool reads all `audit-*.jsonl` files and verifies the combined hash chain."
|
|
45335
45665
|
)
|
|
45336
45666
|
};
|
|
@@ -45354,7 +45684,7 @@ function registerVerifyAuditChainTool(server, deps) {
|
|
|
45354
45684
|
}
|
|
45355
45685
|
|
|
45356
45686
|
// src/mcp/tools/suggest-research-tasks-tool.ts
|
|
45357
|
-
import { z as
|
|
45687
|
+
import { z as z101 } from "zod";
|
|
45358
45688
|
var SUGGEST_RESEARCH_TASKS_NOTE = "Suggestions derived from external research (untrusted); review before acting \u2014 nothing was executed or filed.";
|
|
45359
45689
|
var RESEARCH_BUDGET_MS = 2e4;
|
|
45360
45690
|
var RESEARCH_TIMED_OUT = /* @__PURE__ */ Symbol("research-budget-exceeded");
|
|
@@ -45371,11 +45701,11 @@ async function withResearchBudget(p, ms) {
|
|
|
45371
45701
|
if (timer !== void 0) clearTimeout(timer);
|
|
45372
45702
|
}
|
|
45373
45703
|
}
|
|
45374
|
-
var SuggestResearchTasksInputSchema =
|
|
45375
|
-
topic:
|
|
45376
|
-
qualityThreshold:
|
|
45377
|
-
maxTriggers:
|
|
45378
|
-
existingTaskIds:
|
|
45704
|
+
var SuggestResearchTasksInputSchema = z101.object({
|
|
45705
|
+
topic: z101.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
45706
|
+
qualityThreshold: z101.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
45707
|
+
maxTriggers: z101.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
45708
|
+
existingTaskIds: z101.array(z101.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
45379
45709
|
});
|
|
45380
45710
|
function toTriggerConfig(input) {
|
|
45381
45711
|
return {
|
|
@@ -45432,10 +45762,10 @@ var DESCRIPTION3 = "SUGGEST-ONLY: surface candidate pipeline tasks for human/orc
|
|
|
45432
45762
|
function registerSuggestResearchTasksTool(server, deps) {
|
|
45433
45763
|
const logger57 = deps.logger ?? createLogger({ tool: "suggest_research_tasks" });
|
|
45434
45764
|
const toolSchema = {
|
|
45435
|
-
topic:
|
|
45436
|
-
qualityThreshold:
|
|
45437
|
-
maxTriggers:
|
|
45438
|
-
existingTaskIds:
|
|
45765
|
+
topic: z101.string().optional().describe("Topic filter passed to research_discover. Optional."),
|
|
45766
|
+
qualityThreshold: z101.number().min(0).max(10).optional().describe("Minimum quality score (0-10) a discovery must meet to be suggested. Optional."),
|
|
45767
|
+
maxTriggers: z101.number().int().min(1).optional().describe("Max number of candidate tasks to return (>=1). Optional."),
|
|
45768
|
+
existingTaskIds: z101.array(z101.string()).optional().describe("Known task IDs to skip (dedup). Optional.")
|
|
45439
45769
|
};
|
|
45440
45770
|
const secureHandler = createSecureHandler(
|
|
45441
45771
|
(args) => suggestResearchTasksHandler(args, logger57),
|
|
@@ -45463,7 +45793,7 @@ function registerSuggestResearchTasksTool(server, deps) {
|
|
|
45463
45793
|
}
|
|
45464
45794
|
|
|
45465
45795
|
// src/mcp/tools/run-tool.ts
|
|
45466
|
-
import { z as
|
|
45796
|
+
import { z as z105 } from "zod";
|
|
45467
45797
|
import { randomUUID as randomUUID17 } from "crypto";
|
|
45468
45798
|
|
|
45469
45799
|
// src/orchestration/meta-orchestrator.ts
|
|
@@ -45708,8 +46038,8 @@ function createMetaOrchestrator(options) {
|
|
|
45708
46038
|
}
|
|
45709
46039
|
|
|
45710
46040
|
// src/orchestration/meta-shadow-selector.ts
|
|
45711
|
-
import { appendFileSync as
|
|
45712
|
-
import { z as
|
|
46041
|
+
import { appendFileSync as appendFileSync6, existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
46042
|
+
import { z as z102 } from "zod";
|
|
45713
46043
|
var SHADOW_STRATEGY_ARMS = [
|
|
45714
46044
|
"single-shot",
|
|
45715
46045
|
"dev-pipeline",
|
|
@@ -45790,19 +46120,19 @@ function createHydratableSelector() {
|
|
|
45790
46120
|
var META_OUTCOME_SCHEMA_VERSION = 1;
|
|
45791
46121
|
var HYDRATE_LOOKBACK_DAYS = 30;
|
|
45792
46122
|
var HYDRATE_LOOKBACK_MS = HYDRATE_LOOKBACK_DAYS * 24 * 60 * 60 * 1e3;
|
|
45793
|
-
var PersistedContextSchema =
|
|
45794
|
-
taskComplexity:
|
|
45795
|
-
contextLengthNormalized:
|
|
45796
|
-
isCodeTask:
|
|
45797
|
-
isReasoningTask:
|
|
45798
|
-
budgetUtilization:
|
|
45799
|
-
timePressure:
|
|
46123
|
+
var PersistedContextSchema = z102.object({
|
|
46124
|
+
taskComplexity: z102.number(),
|
|
46125
|
+
contextLengthNormalized: z102.number(),
|
|
46126
|
+
isCodeTask: z102.number(),
|
|
46127
|
+
isReasoningTask: z102.number(),
|
|
46128
|
+
budgetUtilization: z102.number(),
|
|
46129
|
+
timePressure: z102.number()
|
|
45800
46130
|
});
|
|
45801
|
-
var PersistedMetaOutcomeSchema =
|
|
45802
|
-
schema:
|
|
45803
|
-
timestamp:
|
|
45804
|
-
strategy:
|
|
45805
|
-
success:
|
|
46131
|
+
var PersistedMetaOutcomeSchema = z102.object({
|
|
46132
|
+
schema: z102.literal(META_OUTCOME_SCHEMA_VERSION),
|
|
46133
|
+
timestamp: z102.string(),
|
|
46134
|
+
strategy: z102.enum(SHADOW_STRATEGY_ARMS),
|
|
46135
|
+
success: z102.boolean(),
|
|
45806
46136
|
context: PersistedContextSchema
|
|
45807
46137
|
});
|
|
45808
46138
|
var persistLogger = createLogger({ component: "MetaShadowSelector" });
|
|
@@ -45816,7 +46146,7 @@ function persistMetaOutcome(strategy, decision, success) {
|
|
|
45816
46146
|
};
|
|
45817
46147
|
try {
|
|
45818
46148
|
ensureLearningDir();
|
|
45819
|
-
|
|
46149
|
+
appendFileSync6(getMetaOutcomesFile(), JSON.stringify(record) + "\n", "utf-8");
|
|
45820
46150
|
} catch (err2) {
|
|
45821
46151
|
persistLogger.warn("Failed to persist meta-outcome (ignored)", {
|
|
45822
46152
|
error: getErrorMessage(err2)
|
|
@@ -45827,11 +46157,11 @@ function hydrateShadowSelector(selector) {
|
|
|
45827
46157
|
const hydratable = selector;
|
|
45828
46158
|
if (typeof hydratable.recordFromContext !== "function") return 0;
|
|
45829
46159
|
const file = getMetaOutcomesFile();
|
|
45830
|
-
if (!
|
|
46160
|
+
if (!existsSync12(file)) return 0;
|
|
45831
46161
|
let replayed = 0;
|
|
45832
46162
|
try {
|
|
45833
46163
|
const cutoff = Date.now() - HYDRATE_LOOKBACK_MS;
|
|
45834
|
-
const lines =
|
|
46164
|
+
const lines = readFileSync10(file, "utf-8").split("\n").filter((l) => l.trim().length > 0);
|
|
45835
46165
|
for (const line of lines) {
|
|
45836
46166
|
let parsed;
|
|
45837
46167
|
try {
|
|
@@ -45973,7 +46303,7 @@ function createMetaDispatcher(options) {
|
|
|
45973
46303
|
}
|
|
45974
46304
|
|
|
45975
46305
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
45976
|
-
import { z as
|
|
46306
|
+
import { z as z103 } from "zod";
|
|
45977
46307
|
import * as fs11 from "fs";
|
|
45978
46308
|
import * as path10 from "path";
|
|
45979
46309
|
import { randomUUID as randomUUID15 } from "crypto";
|
|
@@ -46122,36 +46452,36 @@ function createTaskTracker(config) {
|
|
|
46122
46452
|
|
|
46123
46453
|
// src/mcp/tools/dev-pipeline-tool.ts
|
|
46124
46454
|
var DEV_PIPELINE_ASYNC_HINT = "A full run_dev_pipeline run can exceed the 900s synchronous MCP timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
46125
|
-
var DevPipelineInputSchema =
|
|
46455
|
+
var DevPipelineInputSchema = z103.object({
|
|
46126
46456
|
/** Direct task instructions. */
|
|
46127
|
-
task:
|
|
46457
|
+
task: z103.string().max(1e4).optional().describe("Direct task instructions (what to build)"),
|
|
46128
46458
|
/** Path to a plan file (.md, .yaml, .txt) to use as input. */
|
|
46129
|
-
planFile:
|
|
46459
|
+
planFile: z103.string().max(500).optional().describe("Path to a plan/spec file to use as input"),
|
|
46130
46460
|
/** Whether to run in dry-run mode (plan+vote only, no implementation). */
|
|
46131
|
-
dryRun:
|
|
46461
|
+
dryRun: z103.boolean().default(false).describe("If true, stop after plan+vote (no implementation)"),
|
|
46132
46462
|
/** Maximum vote iterations before proceeding (default: 3). */
|
|
46133
|
-
maxVoteIterations:
|
|
46463
|
+
maxVoteIterations: z103.number().int().min(1).max(5).default(3).describe("Max plan\u2192vote iterations"),
|
|
46134
46464
|
/** Maximum QA iterations per task (default: 3). */
|
|
46135
|
-
maxQaIterations:
|
|
46465
|
+
maxQaIterations: z103.number().int().min(1).max(5).default(3).describe("Max QA review iterations per task"),
|
|
46136
46466
|
/** Working directory for the pipeline (default: cwd). Used for security scan and context. */
|
|
46137
|
-
workingDir:
|
|
46467
|
+
workingDir: z103.string().max(500).optional().describe("Working directory (default: cwd)"),
|
|
46138
46468
|
/** GitHub issue number to track progress on. Updates posted as comments. */
|
|
46139
|
-
issueNumber:
|
|
46469
|
+
issueNumber: z103.number().int().positive().optional().describe("GitHub issue to post progress to"),
|
|
46140
46470
|
/** GitHub repo (owner/name) for issue tracking. */
|
|
46141
|
-
repo:
|
|
46471
|
+
repo: z103.string().max(200).optional().describe("GitHub repo for issue tracking (e.g., owner/repo)"),
|
|
46142
46472
|
/** Task tracking backend: github, gitlab, or json (default: json). */
|
|
46143
|
-
trackerBackend:
|
|
46473
|
+
trackerBackend: z103.enum(["github", "gitlab", "json"]).default("json").describe("Task tracking backend for issue creation"),
|
|
46144
46474
|
/** Labels to apply to created issues. */
|
|
46145
|
-
labels:
|
|
46475
|
+
labels: z103.array(z103.string()).optional().describe("Labels for created issues"),
|
|
46146
46476
|
/** Session ID for checkpoint/resume. Enables crash recovery. */
|
|
46147
|
-
sessionId:
|
|
46477
|
+
sessionId: z103.string().max(128).regex(/^[a-zA-Z0-9_-]+$/).optional().describe("Session ID for checkpoint/resume (crash recovery)"),
|
|
46148
46478
|
/**
|
|
46149
46479
|
* TESTS ONLY — when true, voters return random decisions. Must not be used as
|
|
46150
46480
|
* a fallback when adapters are unavailable; configure an adapter instead. (#2319)
|
|
46151
46481
|
*/
|
|
46152
|
-
simulateVotes:
|
|
46482
|
+
simulateVotes: z103.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)"),
|
|
46153
46483
|
/** Voting strategy for consensus stages. */
|
|
46154
|
-
votingStrategy:
|
|
46484
|
+
votingStrategy: z103.enum([
|
|
46155
46485
|
"simple_majority",
|
|
46156
46486
|
"supermajority",
|
|
46157
46487
|
"unanimous",
|
|
@@ -46160,11 +46490,11 @@ var DevPipelineInputSchema = z102.object({
|
|
|
46160
46490
|
"opinion_wise"
|
|
46161
46491
|
]).optional().describe("Voting strategy for plan approval (default: higher_order)"),
|
|
46162
46492
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
46163
|
-
quickMode:
|
|
46493
|
+
quickMode: z103.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
46164
46494
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
46165
|
-
timeoutMs:
|
|
46495
|
+
timeoutMs: z103.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
46166
46496
|
/** Pipeline execution mode. */
|
|
46167
|
-
mode:
|
|
46497
|
+
mode: z103.enum(["autonomous", "harness"]).default("autonomous").describe(
|
|
46168
46498
|
"'autonomous': full pipeline. 'harness': stops after decompose, returns tasks for caller to implement."
|
|
46169
46499
|
),
|
|
46170
46500
|
/**
|
|
@@ -46175,15 +46505,15 @@ var DevPipelineInputSchema = z102.object({
|
|
|
46175
46505
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is
|
|
46176
46506
|
* true (plan+vote completes fast, so dry runs always stay sync).
|
|
46177
46507
|
*/
|
|
46178
|
-
dispatch:
|
|
46508
|
+
dispatch: z103.enum(["sync", "async"]).default("sync").describe(
|
|
46179
46509
|
"Dispatch mode (#3726). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
46180
46510
|
),
|
|
46181
46511
|
/** Local pre-ship quality gate (typecheck/lint/tests) mode (#3356). */
|
|
46182
|
-
qualityGate:
|
|
46512
|
+
qualityGate: z103.enum(["off", "advisory", "blocking"]).default("off").describe(
|
|
46183
46513
|
"Pre-ship local quality gate. 'off' (default): skip. 'advisory': run + record feedback, never fail. 'blocking': a red gate fails the pipeline."
|
|
46184
46514
|
),
|
|
46185
46515
|
/** Opt-in per-run token budget — a safety cap for unattended runs (#3395). */
|
|
46186
|
-
maxBudgetTokens:
|
|
46516
|
+
maxBudgetTokens: z103.number().int().positive().optional().describe(
|
|
46187
46517
|
"Per-run token ceiling (#3395). When set, expert calls stop (returning failures) once cumulative usage crosses it \u2014 a hard-stop safety cap for unattended/multi-day runs. Omit to disable (default)."
|
|
46188
46518
|
)
|
|
46189
46519
|
});
|
|
@@ -46348,20 +46678,20 @@ function registerDevPipelineTool(server, deps) {
|
|
|
46348
46678
|
}
|
|
46349
46679
|
|
|
46350
46680
|
// src/mcp/tools/pipeline-tool.ts
|
|
46351
|
-
import { z as
|
|
46681
|
+
import { z as z104 } from "zod";
|
|
46352
46682
|
import * as fs12 from "fs";
|
|
46353
46683
|
import * as path11 from "path";
|
|
46354
46684
|
import { randomUUID as randomUUID16 } from "crypto";
|
|
46355
46685
|
var PIPELINE_ASYNC_HINT = "A full run_pipeline run can exceed the synchronous MCP request timeout. Retry with `dispatch: 'async'` to get a jobId immediately, then poll get_job_result({ jobId }) for the result.";
|
|
46356
|
-
var PipelineInputSchema =
|
|
46686
|
+
var PipelineInputSchema = z104.object({
|
|
46357
46687
|
/** The task to execute. */
|
|
46358
|
-
task:
|
|
46688
|
+
task: z104.string().min(5).max(1e4).describe("Task description \u2014 pipeline template auto-selected based on content"),
|
|
46359
46689
|
/** Path to a spec file (.md, .yaml) to use as task input. */
|
|
46360
|
-
specFile:
|
|
46690
|
+
specFile: z104.string().max(500).optional().describe("Path to a spec file \u2014 content prepended to task for greenfield projects"),
|
|
46361
46691
|
/** Override template — see `listTemplateIds()` for the canonical list (#2728). Auto-detected if omitted. */
|
|
46362
|
-
template:
|
|
46692
|
+
template: z104.string().max(50).optional().describe(`Pipeline template override. Available: ${listTemplateIds().join(", ")}`),
|
|
46363
46693
|
/** Voting strategy for consensus stages. */
|
|
46364
|
-
votingStrategy:
|
|
46694
|
+
votingStrategy: z104.enum([
|
|
46365
46695
|
"simple_majority",
|
|
46366
46696
|
"supermajority",
|
|
46367
46697
|
"unanimous",
|
|
@@ -46372,11 +46702,11 @@ var PipelineInputSchema = z103.object({
|
|
|
46372
46702
|
"Voting strategy for plan approval. simple_majority (default), supermajority (67%), unanimous, higher_order (Bayesian), proof_of_learning, opinion_wise"
|
|
46373
46703
|
),
|
|
46374
46704
|
/** Use 3 agents instead of 6 for faster voting. */
|
|
46375
|
-
quickMode:
|
|
46705
|
+
quickMode: z104.boolean().default(false).describe("Use 3 agents instead of 6 for faster consensus voting"),
|
|
46376
46706
|
/** Maximum execution time per stage in milliseconds (min 30s, max 600s). */
|
|
46377
|
-
timeoutMs:
|
|
46707
|
+
timeoutMs: z104.number().int().min(3e4).max(6e5).optional().describe("Max time per stage in ms (30000-600000). Default: varies by stage complexity"),
|
|
46378
46708
|
/** Stop after planning/voting (no implementation). */
|
|
46379
|
-
dryRun:
|
|
46709
|
+
dryRun: z104.boolean().default(false).describe("Stop after vote stage (no implementation)"),
|
|
46380
46710
|
/**
|
|
46381
46711
|
* Dispatch mode (#3730). `sync` (default) runs the pipeline inline and
|
|
46382
46712
|
* returns the result — but a real multi-stage adaptive run can exceed the
|
|
@@ -46385,11 +46715,11 @@ var PipelineInputSchema = z103.object({
|
|
|
46385
46715
|
* `get_job_result({ jobId })` for the result. Ignored when `dryRun` is true
|
|
46386
46716
|
* (plan+vote completes fast, so dry runs always stay sync).
|
|
46387
46717
|
*/
|
|
46388
|
-
dispatch:
|
|
46718
|
+
dispatch: z104.enum(["sync", "async"]).default("sync").describe(
|
|
46389
46719
|
"Dispatch mode (#3730). 'sync' (default): run inline. 'async': return a jobId immediately + run in background (poll get_job_result). Ignored for dryRun."
|
|
46390
46720
|
),
|
|
46391
46721
|
/** TESTS ONLY — random output, must not be used for real decisions. (#2319) */
|
|
46392
|
-
simulateVotes:
|
|
46722
|
+
simulateVotes: z104.boolean().default(false).describe("TESTS ONLY \u2014 random output, must not be used for real decisions (#2319)")
|
|
46393
46723
|
});
|
|
46394
46724
|
function buildOutput2(result) {
|
|
46395
46725
|
return {
|
|
@@ -46535,9 +46865,9 @@ function registerPipelineTool(server, deps) {
|
|
|
46535
46865
|
}
|
|
46536
46866
|
|
|
46537
46867
|
// src/mcp/tools/run-tool.ts
|
|
46538
|
-
var RunInputSchema =
|
|
46539
|
-
goal:
|
|
46540
|
-
forceStrategy:
|
|
46868
|
+
var RunInputSchema = z105.object({
|
|
46869
|
+
goal: z105.string().min(1).describe("Natural-language goal. nexus-agents selects how to execute it."),
|
|
46870
|
+
forceStrategy: z105.enum([
|
|
46541
46871
|
"single-shot",
|
|
46542
46872
|
"dev-pipeline",
|
|
46543
46873
|
"pipeline",
|
|
@@ -46549,10 +46879,10 @@ var RunInputSchema = z104.object({
|
|
|
46549
46879
|
]).optional().describe(
|
|
46550
46880
|
"Power-user override: force a specific strategy instead of letting the router choose."
|
|
46551
46881
|
),
|
|
46552
|
-
requiresConsensus:
|
|
46553
|
-
dependencyStructure:
|
|
46554
|
-
isNovel:
|
|
46555
|
-
execute:
|
|
46882
|
+
requiresConsensus: z105.boolean().optional().describe("Hint: the task needs a multi-perspective consensus decision."),
|
|
46883
|
+
dependencyStructure: z105.enum(["linear", "dag", "independent", "unknown"]).optional().describe("Hint: the dependency structure of the work."),
|
|
46884
|
+
isNovel: z105.boolean().optional().describe("Hint: this kind of task has not been seen before."),
|
|
46885
|
+
execute: z105.boolean().optional().describe(
|
|
46556
46886
|
"When true, actually run the selected strategy (if an executor is wired) and return its result; otherwise return the routing decision only (default false, read-only)."
|
|
46557
46887
|
),
|
|
46558
46888
|
/**
|
|
@@ -46563,7 +46893,7 @@ var RunInputSchema = z104.object({
|
|
|
46563
46893
|
* envelope immediately and runs in the background; poll
|
|
46564
46894
|
* `get_job_result({ jobId })`. Ignored for read-only routing (execute:false).
|
|
46565
46895
|
*/
|
|
46566
|
-
dispatch:
|
|
46896
|
+
dispatch: z105.enum(["sync", "async"]).optional().describe(
|
|
46567
46897
|
"Dispatch mode (#3732). 'sync' (default): run inline. 'async' (only with execute:true): return a jobId immediately + run in background (poll get_job_result)."
|
|
46568
46898
|
)
|
|
46569
46899
|
});
|
|
@@ -46733,12 +47063,12 @@ function registerRunTool(server, deps) {
|
|
|
46733
47063
|
}
|
|
46734
47064
|
|
|
46735
47065
|
// src/mcp/tools/list-available-models-tool.ts
|
|
46736
|
-
import { z as
|
|
47066
|
+
import { z as z106 } from "zod";
|
|
46737
47067
|
var DESCRIPTION5 = "Probe every model-discovery transport (OpenRouter API + opencode/claude/codex/gemini CLIs) and report a per-transport health summary: probe ok/failed, model count, and a sample of ids. Use it to validate the CLIs and APIs are wired and reachable. Read-only; does not change routing.";
|
|
46738
47068
|
var PROBE_TIMEOUT_MS = 12e3;
|
|
46739
|
-
var ListAvailableModelsInputSchema =
|
|
46740
|
-
includeModelIds:
|
|
46741
|
-
includeOpenRouter:
|
|
47069
|
+
var ListAvailableModelsInputSchema = z106.object({
|
|
47070
|
+
includeModelIds: z106.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
47071
|
+
includeOpenRouter: z106.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
46742
47072
|
});
|
|
46743
47073
|
async function probeSource(source, includeModelIds) {
|
|
46744
47074
|
let timer;
|
|
@@ -46802,8 +47132,8 @@ async function listAvailableModelsHandler(args, deps, logger57) {
|
|
|
46802
47132
|
function registerListAvailableModelsTool(server, deps) {
|
|
46803
47133
|
const logger57 = deps.logger ?? createLogger({ tool: "list_available_models" });
|
|
46804
47134
|
const toolSchema = {
|
|
46805
|
-
includeModelIds:
|
|
46806
|
-
includeOpenRouter:
|
|
47135
|
+
includeModelIds: z106.boolean().optional().describe("Include the full model-id list per transport (default false \u2192 sample of 5 only)."),
|
|
47136
|
+
includeOpenRouter: z106.boolean().optional().describe("Probe the OpenRouter live catalog (default true).")
|
|
46807
47137
|
};
|
|
46808
47138
|
const secureHandler = createSecureHandler(
|
|
46809
47139
|
(args) => listAvailableModelsHandler(args, deps, logger57),
|
|
@@ -46827,7 +47157,7 @@ function registerListAvailableModelsTool(server, deps) {
|
|
|
46827
47157
|
}
|
|
46828
47158
|
|
|
46829
47159
|
// src/mcp/tools/pr-review-eval-types.ts
|
|
46830
|
-
import { z as
|
|
47160
|
+
import { z as z107 } from "zod";
|
|
46831
47161
|
var PR_REVIEW_EVAL_ROLES = [
|
|
46832
47162
|
"architect",
|
|
46833
47163
|
"security",
|
|
@@ -46835,43 +47165,43 @@ var PR_REVIEW_EVAL_ROLES = [
|
|
|
46835
47165
|
"catfish",
|
|
46836
47166
|
"scope_steward"
|
|
46837
47167
|
];
|
|
46838
|
-
var PrReviewEvalRoleSchema =
|
|
46839
|
-
var PrReviewCaseClassSchema =
|
|
46840
|
-
var VoterEvalVerdictSchema =
|
|
47168
|
+
var PrReviewEvalRoleSchema = z107.enum(PR_REVIEW_EVAL_ROLES);
|
|
47169
|
+
var PrReviewCaseClassSchema = z107.enum(["buggy", "clean", "borderline"]);
|
|
47170
|
+
var VoterEvalVerdictSchema = z107.object({
|
|
46841
47171
|
/** Stable record id (e.g. `${runId}:${caseNumber}:${role}`). */
|
|
46842
|
-
id:
|
|
47172
|
+
id: z107.string().min(1).max(160),
|
|
46843
47173
|
/** The pr_review run / batch this verdict belongs to. */
|
|
46844
|
-
runId:
|
|
47174
|
+
runId: z107.string().min(1).max(64),
|
|
46845
47175
|
/** Dataset case identifier (the dataset's `number` field). */
|
|
46846
|
-
caseNumber:
|
|
47176
|
+
caseNumber: z107.string().min(1).max(80),
|
|
46847
47177
|
/** Rubric class of the case (ground-truth label). */
|
|
46848
47178
|
caseClass: PrReviewCaseClassSchema,
|
|
46849
47179
|
/** The voter role being scored. */
|
|
46850
47180
|
role: PrReviewEvalRoleSchema,
|
|
46851
47181
|
/** Verified findings that matched a known bug. */
|
|
46852
|
-
truePositives:
|
|
47182
|
+
truePositives: z107.number().int().nonnegative(),
|
|
46853
47183
|
/** Verified findings on clean code that matched no known bug. */
|
|
46854
|
-
falsePositives:
|
|
47184
|
+
falsePositives: z107.number().int().nonnegative(),
|
|
46855
47185
|
/** Known bugs this voter failed to flag. */
|
|
46856
|
-
falseNegatives:
|
|
47186
|
+
falseNegatives: z107.number().int().nonnegative(),
|
|
46857
47187
|
/** Rubric version the ground truth was adjudicated under. */
|
|
46858
|
-
rubricVersion:
|
|
47188
|
+
rubricVersion: z107.string().min(1).max(32),
|
|
46859
47189
|
/** ISO-8601 timestamp the verdict was recorded. */
|
|
46860
|
-
timestamp:
|
|
47190
|
+
timestamp: z107.string().min(1).max(40)
|
|
46861
47191
|
});
|
|
46862
|
-
var VoterEvalVerdictQuerySchema =
|
|
47192
|
+
var VoterEvalVerdictQuerySchema = z107.object({
|
|
46863
47193
|
role: PrReviewEvalRoleSchema.optional(),
|
|
46864
|
-
runId:
|
|
47194
|
+
runId: z107.string().min(1).max(64).optional(),
|
|
46865
47195
|
caseClass: PrReviewCaseClassSchema.optional(),
|
|
46866
|
-
rubricVersion:
|
|
47196
|
+
rubricVersion: z107.string().min(1).max(32).optional(),
|
|
46867
47197
|
/** ISO-8601 lower bound (inclusive) on `timestamp`. */
|
|
46868
|
-
since:
|
|
47198
|
+
since: z107.string().optional(),
|
|
46869
47199
|
/** Most-recent-N cap. */
|
|
46870
|
-
limit:
|
|
47200
|
+
limit: z107.number().int().positive().optional()
|
|
46871
47201
|
});
|
|
46872
47202
|
|
|
46873
47203
|
// src/mcp/tools/supply-chain-tradeoff-panel.ts
|
|
46874
|
-
import { z as
|
|
47204
|
+
import { z as z108 } from "zod";
|
|
46875
47205
|
import { randomUUID as randomUUID18 } from "crypto";
|
|
46876
47206
|
var DEFAULT_AXES = [
|
|
46877
47207
|
"build_time_determinism",
|
|
@@ -46893,16 +47223,16 @@ var FULL_PANEL = [
|
|
|
46893
47223
|
"scope_steward"
|
|
46894
47224
|
];
|
|
46895
47225
|
var QUICK_PANEL = ["architect", "security", "scope_steward"];
|
|
46896
|
-
var SupplyChainTradeoffPanelInputSchema =
|
|
46897
|
-
proposal:
|
|
46898
|
-
axes:
|
|
47226
|
+
var SupplyChainTradeoffPanelInputSchema = z108.object({
|
|
47227
|
+
proposal: z108.string().min(1).max(MAX_PROPOSAL_LENGTH).describe('The proposal under tradeoff review (e.g. "Should aegis-boot adopt cargo-nextest?")'),
|
|
47228
|
+
axes: z108.array(z108.string().min(1).max(MAX_AXIS_NAME_LENGTH)).min(1).max(MAX_AXES).optional().describe(
|
|
46899
47229
|
`Tradeoff axes to evaluate. Default: ${DEFAULT_AXES.join(", ")}. Custom axes accepted; max ${String(MAX_AXES)}.`
|
|
46900
47230
|
),
|
|
46901
|
-
context:
|
|
47231
|
+
context: z108.string().max(MAX_CONTEXT_LENGTH).optional().describe(
|
|
46902
47232
|
"Optional context: relevant repo state, dependency tree, vendor publishing patterns, etc."
|
|
46903
47233
|
),
|
|
46904
|
-
quickMode:
|
|
46905
|
-
simulate:
|
|
47234
|
+
quickMode: z108.boolean().optional().default(false).describe("Use 3 voters (architect, security, scope_steward) instead of 7"),
|
|
47235
|
+
simulate: z108.boolean().optional().default(false).describe("Use simulated voters (testing only)"),
|
|
46906
47236
|
/**
|
|
46907
47237
|
* Dispatch mode (#3731). `sync` (default) runs the panel inline and returns
|
|
46908
47238
|
* the result — but a live fan-out (up to 7 voters) can exceed the MCP request
|
|
@@ -46910,7 +47240,7 @@ var SupplyChainTradeoffPanelInputSchema = z107.object({
|
|
|
46910
47240
|
* immediately and runs the panel in the background; poll
|
|
46911
47241
|
* `get_job_result({ jobId })` for the result.
|
|
46912
47242
|
*/
|
|
46913
|
-
dispatch:
|
|
47243
|
+
dispatch: z108.enum(["sync", "async"]).default("sync").describe(
|
|
46914
47244
|
"Dispatch mode (#3731). 'sync' (default): run inline. 'async': return a jobId immediately + run the panel in background (poll get_job_result)."
|
|
46915
47245
|
)
|
|
46916
47246
|
});
|
|
@@ -47377,40 +47707,40 @@ var RiskLevel = /* @__PURE__ */ ((RiskLevel2) => {
|
|
|
47377
47707
|
})(RiskLevel || {});
|
|
47378
47708
|
|
|
47379
47709
|
// src/mcp/safety/stpa-schemas.ts
|
|
47380
|
-
import { z as
|
|
47381
|
-
var HazardCategorySchema =
|
|
47382
|
-
var HazardSeveritySchema =
|
|
47383
|
-
var ConstraintPrioritySchema =
|
|
47384
|
-
var RiskLevelSchema =
|
|
47385
|
-
var TriggerPatternSchema =
|
|
47386
|
-
parameter:
|
|
47387
|
-
matchType:
|
|
47388
|
-
pattern:
|
|
47389
|
-
reason:
|
|
47710
|
+
import { z as z109 } from "zod";
|
|
47711
|
+
var HazardCategorySchema = z109.enum(HazardCategory);
|
|
47712
|
+
var HazardSeveritySchema = z109.enum(HazardSeverity);
|
|
47713
|
+
var ConstraintPrioritySchema = z109.enum(ConstraintPriority);
|
|
47714
|
+
var RiskLevelSchema = z109.enum(RiskLevel);
|
|
47715
|
+
var TriggerPatternSchema = z109.object({
|
|
47716
|
+
parameter: z109.string().min(1),
|
|
47717
|
+
matchType: z109.enum(["contains", "regex", "equals", "startsWith", "endsWith"]),
|
|
47718
|
+
pattern: z109.string(),
|
|
47719
|
+
reason: z109.string()
|
|
47390
47720
|
});
|
|
47391
|
-
var HazardSchema =
|
|
47392
|
-
id:
|
|
47393
|
-
description:
|
|
47721
|
+
var HazardSchema = z109.object({
|
|
47722
|
+
id: z109.string().min(1),
|
|
47723
|
+
description: z109.string(),
|
|
47394
47724
|
category: HazardCategorySchema,
|
|
47395
47725
|
severity: HazardSeveritySchema,
|
|
47396
|
-
likelihood:
|
|
47397
|
-
triggerConditions:
|
|
47398
|
-
consequences:
|
|
47726
|
+
likelihood: z109.enum(["almost_certain", "likely", "possible", "unlikely", "rare"]),
|
|
47727
|
+
triggerConditions: z109.array(z109.string()),
|
|
47728
|
+
consequences: z109.array(z109.string())
|
|
47399
47729
|
});
|
|
47400
|
-
var UnsafeControlActionSchema =
|
|
47401
|
-
id:
|
|
47402
|
-
toolName:
|
|
47403
|
-
type:
|
|
47404
|
-
description:
|
|
47405
|
-
unsafeContext:
|
|
47406
|
-
relatedHazards:
|
|
47407
|
-
triggerPatterns:
|
|
47730
|
+
var UnsafeControlActionSchema = z109.object({
|
|
47731
|
+
id: z109.string().min(1),
|
|
47732
|
+
toolName: z109.string().min(1),
|
|
47733
|
+
type: z109.enum(["not_provided", "provided_causes_hazard", "wrong_timing", "wrong_duration"]),
|
|
47734
|
+
description: z109.string(),
|
|
47735
|
+
unsafeContext: z109.string(),
|
|
47736
|
+
relatedHazards: z109.array(z109.string()),
|
|
47737
|
+
triggerPatterns: z109.array(TriggerPatternSchema).optional()
|
|
47408
47738
|
});
|
|
47409
|
-
var SafetyConstraintSchema =
|
|
47410
|
-
id:
|
|
47411
|
-
description:
|
|
47412
|
-
mitigates:
|
|
47413
|
-
enforcement:
|
|
47739
|
+
var SafetyConstraintSchema = z109.object({
|
|
47740
|
+
id: z109.string().min(1),
|
|
47741
|
+
description: z109.string(),
|
|
47742
|
+
mitigates: z109.array(z109.string()),
|
|
47743
|
+
enforcement: z109.enum([
|
|
47414
47744
|
"prevent",
|
|
47415
47745
|
"require_confirmation",
|
|
47416
47746
|
"alert",
|
|
@@ -47418,54 +47748,54 @@ var SafetyConstraintSchema = z108.object({
|
|
|
47418
47748
|
"rate_limit",
|
|
47419
47749
|
"require_privilege"
|
|
47420
47750
|
]),
|
|
47421
|
-
validationFunction:
|
|
47751
|
+
validationFunction: z109.string().optional(),
|
|
47422
47752
|
priority: ConstraintPrioritySchema
|
|
47423
47753
|
});
|
|
47424
|
-
var PropertySchemaSchema =
|
|
47425
|
-
type:
|
|
47426
|
-
description:
|
|
47427
|
-
enum:
|
|
47428
|
-
pattern:
|
|
47429
|
-
minimum:
|
|
47430
|
-
maximum:
|
|
47754
|
+
var PropertySchemaSchema = z109.object({
|
|
47755
|
+
type: z109.string(),
|
|
47756
|
+
description: z109.string().optional(),
|
|
47757
|
+
enum: z109.array(z109.unknown()).optional(),
|
|
47758
|
+
pattern: z109.string().optional(),
|
|
47759
|
+
minimum: z109.number().optional(),
|
|
47760
|
+
maximum: z109.number().optional()
|
|
47431
47761
|
});
|
|
47432
|
-
var ToolInputSchemaSchema =
|
|
47433
|
-
type:
|
|
47434
|
-
properties:
|
|
47435
|
-
required:
|
|
47436
|
-
additionalProperties:
|
|
47762
|
+
var ToolInputSchemaSchema = z109.object({
|
|
47763
|
+
type: z109.string(),
|
|
47764
|
+
properties: z109.record(z109.string(), PropertySchemaSchema).optional(),
|
|
47765
|
+
required: z109.array(z109.string()).optional(),
|
|
47766
|
+
additionalProperties: z109.boolean().optional()
|
|
47437
47767
|
});
|
|
47438
|
-
var ToolDefinitionSchema =
|
|
47439
|
-
name:
|
|
47440
|
-
description:
|
|
47768
|
+
var ToolDefinitionSchema = z109.object({
|
|
47769
|
+
name: z109.string().min(1),
|
|
47770
|
+
description: z109.string(),
|
|
47441
47771
|
inputSchema: ToolInputSchemaSchema
|
|
47442
47772
|
});
|
|
47443
|
-
var AnalysisConfigurationSchema =
|
|
47444
|
-
includeLowSeverity:
|
|
47445
|
-
generateAllConstraints:
|
|
47446
|
-
checkInteractions:
|
|
47447
|
-
maxHazardsPerTool:
|
|
47448
|
-
categories:
|
|
47773
|
+
var AnalysisConfigurationSchema = z109.object({
|
|
47774
|
+
includeLowSeverity: z109.boolean().default(true),
|
|
47775
|
+
generateAllConstraints: z109.boolean().default(true),
|
|
47776
|
+
checkInteractions: z109.boolean().default(true),
|
|
47777
|
+
maxHazardsPerTool: z109.number().int().min(1).max(100).default(50),
|
|
47778
|
+
categories: z109.array(HazardCategorySchema).default([])
|
|
47449
47779
|
});
|
|
47450
|
-
var ConstraintViolationSchema =
|
|
47451
|
-
constraintId:
|
|
47452
|
-
constraintDescription:
|
|
47780
|
+
var ConstraintViolationSchema = z109.object({
|
|
47781
|
+
constraintId: z109.string().min(1),
|
|
47782
|
+
constraintDescription: z109.string(),
|
|
47453
47783
|
severity: HazardSeveritySchema,
|
|
47454
|
-
details:
|
|
47455
|
-
remediation:
|
|
47784
|
+
details: z109.string(),
|
|
47785
|
+
remediation: z109.string()
|
|
47456
47786
|
});
|
|
47457
|
-
var ValidationWarningSchema =
|
|
47458
|
-
code:
|
|
47459
|
-
message:
|
|
47460
|
-
affected:
|
|
47787
|
+
var ValidationWarningSchema = z109.object({
|
|
47788
|
+
code: z109.string().min(1),
|
|
47789
|
+
message: z109.string(),
|
|
47790
|
+
affected: z109.string()
|
|
47461
47791
|
});
|
|
47462
|
-
var ValidationResultSchema =
|
|
47463
|
-
valid:
|
|
47464
|
-
toolName:
|
|
47465
|
-
violations:
|
|
47466
|
-
passed:
|
|
47467
|
-
warnings:
|
|
47468
|
-
validatedAt:
|
|
47792
|
+
var ValidationResultSchema = z109.object({
|
|
47793
|
+
valid: z109.boolean(),
|
|
47794
|
+
toolName: z109.string().min(1),
|
|
47795
|
+
violations: z109.array(ConstraintViolationSchema),
|
|
47796
|
+
passed: z109.array(z109.string()),
|
|
47797
|
+
warnings: z109.array(ValidationWarningSchema),
|
|
47798
|
+
validatedAt: z109.date()
|
|
47469
47799
|
});
|
|
47470
47800
|
|
|
47471
47801
|
// src/mcp/safety/stpa-types.ts
|
|
@@ -48550,56 +48880,56 @@ var GeminiResponseParser = class {
|
|
|
48550
48880
|
};
|
|
48551
48881
|
|
|
48552
48882
|
// src/cli-adapters/router-types.ts
|
|
48553
|
-
import { z as
|
|
48554
|
-
var RouterConfigSchema =
|
|
48555
|
-
minCapacityThreshold:
|
|
48556
|
-
preferCostEfficient:
|
|
48557
|
-
maxDecisionTimeMs:
|
|
48883
|
+
import { z as z110 } from "zod";
|
|
48884
|
+
var RouterConfigSchema = z110.object({
|
|
48885
|
+
minCapacityThreshold: z110.number().min(0).max(1).default(0.1),
|
|
48886
|
+
preferCostEfficient: z110.boolean().default(false),
|
|
48887
|
+
maxDecisionTimeMs: z110.number().min(1).max(1e3).default(100)
|
|
48558
48888
|
});
|
|
48559
48889
|
|
|
48560
48890
|
// src/cli-adapters/agreement-cascade-types.ts
|
|
48561
|
-
import { z as
|
|
48562
|
-
var AgreementCascadeConfigSchema =
|
|
48563
|
-
agreementThreshold:
|
|
48564
|
-
maxStages:
|
|
48565
|
-
modelTimeoutMs:
|
|
48891
|
+
import { z as z111 } from "zod";
|
|
48892
|
+
var AgreementCascadeConfigSchema = z111.object({
|
|
48893
|
+
agreementThreshold: z111.number().min(0.5).max(1).default(0.7),
|
|
48894
|
+
maxStages: z111.number().int().min(1).max(5).default(3),
|
|
48895
|
+
modelTimeoutMs: z111.number().int().min(1e3).max(3e5).default(6e4)
|
|
48566
48896
|
});
|
|
48567
48897
|
|
|
48568
48898
|
// src/cli-adapters/agreement-cascade-router.ts
|
|
48569
48899
|
var logger48 = createLogger({ component: "agreement-cascade-router" });
|
|
48570
48900
|
|
|
48571
48901
|
// src/cli-adapters/task-classifier.ts
|
|
48572
|
-
import { z as
|
|
48573
|
-
var ClassificationPatternsSchema =
|
|
48574
|
-
code:
|
|
48575
|
-
research:
|
|
48576
|
-
documentation:
|
|
48577
|
-
analysis:
|
|
48902
|
+
import { z as z112 } from "zod";
|
|
48903
|
+
var ClassificationPatternsSchema = z112.object({
|
|
48904
|
+
code: z112.array(z112.string()).readonly(),
|
|
48905
|
+
research: z112.array(z112.string()).readonly(),
|
|
48906
|
+
documentation: z112.array(z112.string()).readonly(),
|
|
48907
|
+
analysis: z112.array(z112.string()).readonly()
|
|
48578
48908
|
});
|
|
48579
48909
|
|
|
48580
48910
|
// src/cli-adapters/response-cache-types.ts
|
|
48581
|
-
import { z as
|
|
48582
|
-
var ResponseCacheConfigSchema =
|
|
48583
|
-
defaultTTL:
|
|
48911
|
+
import { z as z113 } from "zod";
|
|
48912
|
+
var ResponseCacheConfigSchema = z113.object({
|
|
48913
|
+
defaultTTL: z113.number().min(1e3).max(36e5).default(3e5),
|
|
48584
48914
|
// 5 minutes
|
|
48585
|
-
maxEntries:
|
|
48586
|
-
maxMemoryMB:
|
|
48587
|
-
cleanupInterval:
|
|
48915
|
+
maxEntries: z113.number().min(10).max(1e5).default(1e3),
|
|
48916
|
+
maxMemoryMB: z113.number().min(1).max(1e3).default(50),
|
|
48917
|
+
cleanupInterval: z113.number().min(1e3).max(6e5).default(6e4),
|
|
48588
48918
|
// 1 minute
|
|
48589
|
-
enableLogging:
|
|
48919
|
+
enableLogging: z113.boolean().default(false)
|
|
48590
48920
|
});
|
|
48591
48921
|
|
|
48592
48922
|
// src/cli-adapters/response-cache-utils.ts
|
|
48593
|
-
import { createHash as
|
|
48923
|
+
import { createHash as createHash6 } from "crypto";
|
|
48594
48924
|
var logger49 = createLogger({ component: "ResponseCacheUtils" });
|
|
48595
48925
|
|
|
48596
48926
|
// src/cli-adapters/unified-routing-types.ts
|
|
48597
|
-
import { z as
|
|
48598
|
-
var UnifiedRoutingDecisionSchema =
|
|
48599
|
-
selectedCli:
|
|
48600
|
-
confidence:
|
|
48601
|
-
reason:
|
|
48602
|
-
strategy:
|
|
48927
|
+
import { z as z114 } from "zod";
|
|
48928
|
+
var UnifiedRoutingDecisionSchema = z114.object({
|
|
48929
|
+
selectedCli: z114.string(),
|
|
48930
|
+
confidence: z114.number().min(0).max(1),
|
|
48931
|
+
reason: z114.string(),
|
|
48932
|
+
strategy: z114.enum([
|
|
48603
48933
|
"composite",
|
|
48604
48934
|
"quality",
|
|
48605
48935
|
"budget",
|
|
@@ -48611,57 +48941,57 @@ var UnifiedRoutingDecisionSchema = z113.object({
|
|
|
48611
48941
|
"linucb",
|
|
48612
48942
|
"direct"
|
|
48613
48943
|
]),
|
|
48614
|
-
decisionTimeMs:
|
|
48615
|
-
alternatives:
|
|
48616
|
-
stagesExecuted:
|
|
48617
|
-
withinBudget:
|
|
48618
|
-
estimatedComplexity:
|
|
48619
|
-
estimatedTokens:
|
|
48620
|
-
topsisScore:
|
|
48621
|
-
ucbScore:
|
|
48622
|
-
resolvedAtStage:
|
|
48623
|
-
consensusReached:
|
|
48624
|
-
agreementScore:
|
|
48625
|
-
metadata:
|
|
48944
|
+
decisionTimeMs: z114.number().nonnegative(),
|
|
48945
|
+
alternatives: z114.array(z114.string()).readonly(),
|
|
48946
|
+
stagesExecuted: z114.array(z114.string()).readonly(),
|
|
48947
|
+
withinBudget: z114.boolean().optional(),
|
|
48948
|
+
estimatedComplexity: z114.enum(["simple", "moderate", "complex", "expert"]).optional(),
|
|
48949
|
+
estimatedTokens: z114.number().int().positive().optional(),
|
|
48950
|
+
topsisScore: z114.number().optional(),
|
|
48951
|
+
ucbScore: z114.number().optional(),
|
|
48952
|
+
resolvedAtStage: z114.number().int().nonnegative().optional(),
|
|
48953
|
+
consensusReached: z114.boolean().optional(),
|
|
48954
|
+
agreementScore: z114.number().min(0).max(1).optional(),
|
|
48955
|
+
metadata: z114.record(z114.string(), z114.unknown()).optional()
|
|
48626
48956
|
});
|
|
48627
48957
|
|
|
48628
48958
|
// src/learning/outcome-feedback-types.ts
|
|
48629
|
-
import { z as
|
|
48630
|
-
var QualitySignalsSchema =
|
|
48631
|
-
testsPass:
|
|
48632
|
-
lintErrors:
|
|
48633
|
-
userApproved:
|
|
48634
|
-
retryCount:
|
|
48635
|
-
completionRatio:
|
|
48636
|
-
validStructure:
|
|
48637
|
-
coherenceScore:
|
|
48959
|
+
import { z as z115 } from "zod";
|
|
48960
|
+
var QualitySignalsSchema = z115.object({
|
|
48961
|
+
testsPass: z115.boolean().optional(),
|
|
48962
|
+
lintErrors: z115.number().int().min(0).optional(),
|
|
48963
|
+
userApproved: z115.boolean().optional(),
|
|
48964
|
+
retryCount: z115.number().int().min(0).default(0),
|
|
48965
|
+
completionRatio: z115.number().min(0).max(1).default(1),
|
|
48966
|
+
validStructure: z115.boolean().optional(),
|
|
48967
|
+
coherenceScore: z115.number().min(0).max(1).optional()
|
|
48638
48968
|
});
|
|
48639
|
-
var RoutingDecisionSchema =
|
|
48640
|
-
id:
|
|
48641
|
-
timestamp:
|
|
48642
|
-
query:
|
|
48643
|
-
routerType:
|
|
48644
|
-
selectedModel:
|
|
48645
|
-
selectedTier:
|
|
48646
|
-
armIndex:
|
|
48647
|
-
banditContext:
|
|
48648
|
-
queryFeatures:
|
|
48649
|
-
ucbScore:
|
|
48650
|
-
confidence:
|
|
48651
|
-
traceId:
|
|
48652
|
-
domain:
|
|
48969
|
+
var RoutingDecisionSchema = z115.object({
|
|
48970
|
+
id: z115.uuid(),
|
|
48971
|
+
timestamp: z115.iso.datetime(),
|
|
48972
|
+
query: z115.string(),
|
|
48973
|
+
routerType: z115.enum(["linucb", "preference", "quality", "cascade", "topsis"]),
|
|
48974
|
+
selectedModel: z115.string(),
|
|
48975
|
+
selectedTier: z115.enum(["strong", "weak"]).optional(),
|
|
48976
|
+
armIndex: z115.number().int().min(0).optional(),
|
|
48977
|
+
banditContext: z115.record(z115.string(), z115.unknown()).optional(),
|
|
48978
|
+
queryFeatures: z115.record(z115.string(), z115.unknown()).optional(),
|
|
48979
|
+
ucbScore: z115.number().optional(),
|
|
48980
|
+
confidence: z115.number().min(0).max(1).optional(),
|
|
48981
|
+
traceId: z115.string(),
|
|
48982
|
+
domain: z115.string().optional()
|
|
48653
48983
|
});
|
|
48654
|
-
var TaskOutcomeSchema =
|
|
48655
|
-
routingDecisionId:
|
|
48656
|
-
timestamp:
|
|
48657
|
-
outcomeClass:
|
|
48658
|
-
success:
|
|
48659
|
-
qualityScore:
|
|
48660
|
-
durationMs:
|
|
48661
|
-
tokenUsage:
|
|
48662
|
-
errorMessage:
|
|
48984
|
+
var TaskOutcomeSchema = z115.object({
|
|
48985
|
+
routingDecisionId: z115.uuid(),
|
|
48986
|
+
timestamp: z115.iso.datetime(),
|
|
48987
|
+
outcomeClass: z115.enum(["success", "partial", "failure", "timeout", "error"]),
|
|
48988
|
+
success: z115.boolean(),
|
|
48989
|
+
qualityScore: z115.number().min(0).max(1),
|
|
48990
|
+
durationMs: z115.number().min(0),
|
|
48991
|
+
tokenUsage: z115.number().int().min(0),
|
|
48992
|
+
errorMessage: z115.string().optional(),
|
|
48663
48993
|
qualitySignals: QualitySignalsSchema,
|
|
48664
|
-
traceId:
|
|
48994
|
+
traceId: z115.string()
|
|
48665
48995
|
});
|
|
48666
48996
|
var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
48667
48997
|
maxPendingDecisions: 1e3,
|
|
@@ -48676,17 +49006,17 @@ var DEFAULT_FEEDBACK_COLLECTOR_CONFIG = {
|
|
|
48676
49006
|
targetTokenUsage: 2e3,
|
|
48677
49007
|
maxHistorySize: 1e4
|
|
48678
49008
|
};
|
|
48679
|
-
var FeedbackCollectorConfigSchema =
|
|
48680
|
-
maxPendingDecisions:
|
|
48681
|
-
pendingTimeoutMs:
|
|
48682
|
-
enableAutoReward:
|
|
48683
|
-
qualityWeight:
|
|
48684
|
-
speedWeight:
|
|
48685
|
-
efficiencyWeight:
|
|
48686
|
-
retryPenalty:
|
|
48687
|
-
targetDurationMs:
|
|
48688
|
-
targetTokenUsage:
|
|
48689
|
-
maxHistorySize:
|
|
49009
|
+
var FeedbackCollectorConfigSchema = z115.object({
|
|
49010
|
+
maxPendingDecisions: z115.number().int().positive().default(1e3),
|
|
49011
|
+
pendingTimeoutMs: z115.number().positive().default(3e5),
|
|
49012
|
+
enableAutoReward: z115.boolean().default(true),
|
|
49013
|
+
qualityWeight: z115.number().min(0).max(1).default(0.5),
|
|
49014
|
+
speedWeight: z115.number().min(0).max(1).default(0.2),
|
|
49015
|
+
efficiencyWeight: z115.number().min(0).max(1).default(0.2),
|
|
49016
|
+
retryPenalty: z115.number().min(0).max(1).default(0.1),
|
|
49017
|
+
targetDurationMs: z115.number().positive().default(5e3),
|
|
49018
|
+
targetTokenUsage: z115.number().positive().default(2e3),
|
|
49019
|
+
maxHistorySize: z115.number().int().positive().default(1e4)
|
|
48690
49020
|
});
|
|
48691
49021
|
|
|
48692
49022
|
// src/learning/outcome-feedback-helpers.ts
|
|
@@ -49336,80 +49666,6 @@ function computeOutcomeReward(collector, outcome) {
|
|
|
49336
49666
|
return collector.computeReward(outcome);
|
|
49337
49667
|
}
|
|
49338
49668
|
|
|
49339
|
-
// src/audit/pr-review-record.ts
|
|
49340
|
-
import * as crypto2 from "crypto";
|
|
49341
|
-
import { z as z115 } from "zod";
|
|
49342
|
-
var PrReviewVerdictSchema = z115.enum(["approve", "request_changes", "abstain"]);
|
|
49343
|
-
var PrReviewVoteCountsSchema = z115.object({
|
|
49344
|
-
approve: z115.number().int().nonnegative(),
|
|
49345
|
-
request_changes: z115.number().int().nonnegative(),
|
|
49346
|
-
abstain: z115.number().int().nonnegative(),
|
|
49347
|
-
error: z115.number().int().nonnegative(),
|
|
49348
|
-
total: z115.number().int().nonnegative()
|
|
49349
|
-
}).strict();
|
|
49350
|
-
var PrReviewRecordSchema = z115.object({
|
|
49351
|
-
/**
|
|
49352
|
-
* Schema version. '1.1' is the Option-C binding (#3831): the record binds to
|
|
49353
|
-
* `{prNumber, baseSha, reviewedDiffHash}` instead of the rejected `headSha`.
|
|
49354
|
-
* Clean break — the committed `governance/pr-review-records.jsonl` ledger is
|
|
49355
|
-
* empty on every install (no producer ever wrote a '1.0' record), so there is
|
|
49356
|
-
* no '1.0' data to migrate.
|
|
49357
|
-
*/
|
|
49358
|
-
version: z115.literal("1.1"),
|
|
49359
|
-
/**
|
|
49360
|
-
* Monotonic sequence number (integer ≥ 0). Assigned as (max existing
|
|
49361
|
-
* sequence)+1 at write time. Sorted, the set of sequences must cover
|
|
49362
|
-
* 0..maxSeq with no gap (omission detection); DUPLICATE sequences are a
|
|
49363
|
-
* benign concurrent-fork signal, not tampering.
|
|
49364
|
-
*/
|
|
49365
|
-
sequence: z115.number().int().nonnegative(),
|
|
49366
|
-
/** The PR number the review covers. */
|
|
49367
|
-
prNumber: z115.number().int().positive(),
|
|
49368
|
-
/**
|
|
49369
|
-
* The 40-hex BASE commit SHA the reviewed diff was computed against (the
|
|
49370
|
-
* `<base>..<head>` range base). Part of the Option-C binding so the gate knows
|
|
49371
|
-
* which range to recompute {@link reviewedDiffHash} over.
|
|
49372
|
-
*/
|
|
49373
|
-
baseSha: z115.string().regex(/^[0-9a-f]{40}$/, "baseSha must be a 40-char lowercase hex commit sha"),
|
|
49374
|
-
/**
|
|
49375
|
-
* DIFF-BINDING (Option-C, #3831): sha256 of the canonical reviewed diff bytes
|
|
49376
|
-
* (see `audit/reviewed-diff-hash.ts` — pinned `git diff` invocation + 50k
|
|
49377
|
-
* byte-truncation). The gate recomputes this from the committed PR's diff and
|
|
49378
|
-
* matches it, so a record only satisfies a PR whose reviewed diff is
|
|
49379
|
-
* byte-identical to what the voters saw. Covered by the self-hash below, so it
|
|
49380
|
-
* cannot be edited to claim a different reviewed diff.
|
|
49381
|
-
*/
|
|
49382
|
-
reviewedDiffHash: z115.string().length(64),
|
|
49383
|
-
/** ISO-8601 timestamp the review was recorded. */
|
|
49384
|
-
recordedAt: z115.string().min(1),
|
|
49385
|
-
/** The resolved aggregate verdict. */
|
|
49386
|
-
verdict: PrReviewVerdictSchema,
|
|
49387
|
-
/**
|
|
49388
|
-
* Whether the aggregate carried a VERIFIED finding (the 4-point gate). A
|
|
49389
|
-
* `request_changes` with `verified: true` is a strict blocker; covered by the
|
|
49390
|
-
* hash so it cannot be flipped without detection.
|
|
49391
|
-
*/
|
|
49392
|
-
verified: z115.boolean(),
|
|
49393
|
-
/** Per-decision voter tally from the pr_review aggregate. */
|
|
49394
|
-
voteCounts: PrReviewVoteCountsSchema,
|
|
49395
|
-
/** Truncated human-readable review summary for the reviewer record. */
|
|
49396
|
-
summary: z115.string(),
|
|
49397
|
-
/** Optional correlation/decision id linking to the cost rollup / trace. */
|
|
49398
|
-
correlationId: z115.string().min(1).optional(),
|
|
49399
|
-
/**
|
|
49400
|
-
* ADVISORY hash of the tip record at write time (absent for the first).
|
|
49401
|
-
* Retained for audit texture but NOT covered by `hash` and NOT verified —
|
|
49402
|
-
* the record-set model is position-independent (mirrors #3927).
|
|
49403
|
-
*/
|
|
49404
|
-
previousHash: z115.string().length(64).optional(),
|
|
49405
|
-
/** SHA-256 over every field above EXCEPT `previousHash` (and except `hash`). */
|
|
49406
|
-
hash: z115.string().length(64)
|
|
49407
|
-
}).strict();
|
|
49408
|
-
|
|
49409
|
-
// src/audit/pr-review-record-store.ts
|
|
49410
|
-
import { existsSync as existsSync12, readFileSync as readFileSync10 } from "fs";
|
|
49411
|
-
import { isAbsolute, join as join10, resolve as resolve17 } from "path";
|
|
49412
|
-
|
|
49413
49669
|
// src/security/sandbox/sandbox-types.ts
|
|
49414
49670
|
var DEFAULT_RESOURCE_LIMITS = {
|
|
49415
49671
|
maxMemoryBytes: 512 * 1024 * 1024,
|
|
@@ -50907,4 +51163,4 @@ export {
|
|
|
50907
51163
|
shutdownFeedbackSubscriber,
|
|
50908
51164
|
createEventBusBridge
|
|
50909
51165
|
};
|
|
50910
|
-
//# sourceMappingURL=chunk-
|
|
51166
|
+
//# sourceMappingURL=chunk-4VCLI2T3.js.map
|