nexus-agents 8.8.2 → 8.9.1
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/{ast-rule-runner-WANOR3MX.js → ast-rule-runner-BEUFFQWL.js} +3 -3
- package/dist/{child-mcp-config-N4HLLCEH.js → child-mcp-config-QFPSL7Y2.js} +2 -2
- package/dist/{chunk-VADACTVB.js → chunk-2RZWKIDU.js} +2 -2
- package/dist/{chunk-QCSXKQTK.js → chunk-36BA6D6J.js} +2 -2
- package/dist/{chunk-BYUVLVN7.js → chunk-3W4L63ML.js} +1 -1
- package/dist/chunk-3W4L63ML.js.map +1 -0
- package/dist/{chunk-3YKFLM2B.js → chunk-46YGVSBD.js} +2 -2
- package/dist/chunk-46YGVSBD.js.map +1 -0
- package/dist/{chunk-7J7UYJXC.js → chunk-4GSFZS6M.js} +7 -7
- package/dist/{chunk-ERL3XHQO.js → chunk-AOBIUJX5.js} +3 -3
- package/dist/{chunk-276GRITW.js → chunk-BTPPGHG3.js} +4 -4
- package/dist/{chunk-II5NJRKH.js → chunk-CMQO6WEQ.js} +2 -2
- package/dist/{chunk-WXU4Y5T3.js → chunk-D3TZZO6L.js} +2 -2
- package/dist/chunk-DJFYMDMD.js +7 -0
- package/dist/{chunk-K2PVLCHR.js → chunk-DLVIES6W.js} +2 -2
- package/dist/{chunk-3XQK4MEF.js → chunk-FDZ3SLMV.js} +2 -2
- package/dist/{chunk-W6SM3MU5.js → chunk-FMKEGR6N.js} +3 -3
- package/dist/{chunk-F2GERNMF.js → chunk-FOYSPWOA.js} +2 -2
- package/dist/{chunk-MXQG3A5W.js → chunk-FPHFCZ2E.js} +976 -132
- package/dist/chunk-FPHFCZ2E.js.map +1 -0
- package/dist/{chunk-TZWJ7QLW.js → chunk-HQ2A4DGU.js} +2 -2
- package/dist/{chunk-3CLKYFE3.js → chunk-I3J7WUMV.js} +2 -2
- package/dist/{chunk-64VMTY3M.js → chunk-K2GDWPVK.js} +2 -2
- package/dist/{chunk-QY3HOLGD.js → chunk-KE5IGD6G.js} +7 -7
- package/dist/{chunk-N347WXTT.js → chunk-M33EQB7P.js} +2 -2
- package/dist/chunk-M33EQB7P.js.map +1 -0
- package/dist/{chunk-CQCVEC7P.js → chunk-MYERGZK3.js} +945 -1111
- package/dist/chunk-MYERGZK3.js.map +1 -0
- package/dist/{chunk-SNSPYZQT.js → chunk-MZUUIMRQ.js} +5 -5
- package/dist/{chunk-7QQ5F7T5.js → chunk-OJSG734P.js} +8 -8
- package/dist/{chunk-YQUM3UWK.js → chunk-P2DV7PDG.js} +4 -4
- package/dist/{chunk-SQCFKQUR.js → chunk-P64GQUQW.js} +9 -9
- package/dist/{chunk-GXLI2E4U.js → chunk-PCPQ75EC.js} +4 -4
- package/dist/{chunk-Q5V3KTUL.js → chunk-Q55JVMUD.js} +2 -2
- package/dist/{chunk-EALWAQAQ.js → chunk-S2B4UBHK.js} +5 -5
- package/dist/{chunk-NR62IQDC.js → chunk-SGOBMAZK.js} +4 -4
- package/dist/{chunk-NR62IQDC.js.map → chunk-SGOBMAZK.js.map} +1 -1
- package/dist/{chunk-FBWOWMEB.js → chunk-UXCE2OBL.js} +21 -19
- package/dist/chunk-UXCE2OBL.js.map +1 -0
- package/dist/{chunk-7AU5WLAJ.js → chunk-V7PXKAZD.js} +2 -2
- package/dist/{chunk-FKKVZRSY.js → chunk-VQRXDFVF.js} +2 -2
- package/dist/{chunk-6HETGJSB.js → chunk-WANBZFP2.js} +2 -2
- package/dist/{chunk-ZGHJMFQ6.js → chunk-WFZARRYN.js} +3 -3
- package/dist/{chunk-AOS7F4QR.js → chunk-WKYDGROH.js} +2 -2
- package/dist/{cli-circuit-breaker-AAHYLFXZ.js → cli-circuit-breaker-BOZNYIZE.js} +3 -3
- package/dist/cli.js +82 -64
- package/dist/cli.js.map +1 -1
- package/dist/{composite-router-VAVDLJGT.js → composite-router-NG7BLVVR.js} +2 -2
- package/dist/{consensus-vote-L4CN33XE.js → consensus-vote-3FCOFDON.js} +17 -17
- package/dist/{context-retriever-MYKBBDAN.js → context-retriever-QKMSSV6W.js} +8 -8
- package/dist/{doctor-deep-AKOPPCXB.js → doctor-deep-CPMR6TDF.js} +3 -3
- package/dist/{doctor-live-3PVIYQST.js → doctor-live-GWE5IA7D.js} +9 -9
- package/dist/{expert-bridge-G3KN7QWL.js → expert-bridge-6WZ333NT.js} +4 -4
- package/dist/{factory-KVMLFEWJ.js → factory-2DD2YGBU.js} +5 -5
- package/dist/{factory-ROTP63IZ.js → factory-73WKMDVR.js} +9 -9
- package/dist/{improvement-review-WTZ4JV5V.js → improvement-review-RMDGMKIB.js} +6 -6
- package/dist/index.d.ts +158 -15
- package/dist/index.js +169 -658
- package/dist/index.js.map +1 -1
- package/dist/{init-opencode-C63LASGX.js → init-opencode-7PKVI3LD.js} +6 -6
- package/dist/issue-triage-MLBUABPA.js +17 -0
- package/dist/{pr-reviewer-helpers-4VDGMGV5.js → pr-reviewer-helpers-7DSP3YTT.js} +5 -5
- package/dist/{registry-command-IRDP2L2R.js → registry-command-YXFZ7LVE.js} +2 -2
- package/dist/{repo-security-plan-NS47HQEF.js → repo-security-plan-M36GODNF.js} +3 -3
- package/dist/{research-helpers-synthesize-5NBL637T.js → research-helpers-synthesize-7CI4MFYP.js} +4 -4
- package/dist/{routing-memory-2IELT5GT.js → routing-memory-MIK3LGDH.js} +2 -2
- package/dist/{session-memory-CH3CVLIT.js → session-memory-T2X4BM33.js} +3 -3
- package/dist/{setup-config-MKZZDUJP.js → setup-config-6JSBY6OG.js} +3 -3
- package/dist/{setup-custom-api-2I52S7XU.js → setup-custom-api-2OXG6ERI.js} +4 -4
- package/dist/setup-data-dir-CWU367E6.js +29 -0
- package/dist/{tool-memory-STS3DWOK.js → tool-memory-AL3RAR67.js} +5 -5
- package/dist/{unified-registry-NJS4ZWC3.js → unified-registry-5YUSIEML.js} +10 -10
- package/dist/{weather-report-YG4T4Q23.js → weather-report-W34L4HW5.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3YKFLM2B.js.map +0 -1
- package/dist/chunk-BYUVLVN7.js.map +0 -1
- package/dist/chunk-CQCVEC7P.js.map +0 -1
- package/dist/chunk-FBWOWMEB.js.map +0 -1
- package/dist/chunk-H5DTHO7O.js +0 -7
- package/dist/chunk-MXQG3A5W.js.map +0 -1
- package/dist/chunk-N347WXTT.js.map +0 -1
- package/dist/issue-triage-PIE3YVCV.js +0 -17
- package/dist/setup-data-dir-NU3YBIZB.js +0 -29
- /package/dist/{ast-rule-runner-WANOR3MX.js.map → ast-rule-runner-BEUFFQWL.js.map} +0 -0
- /package/dist/{child-mcp-config-N4HLLCEH.js.map → child-mcp-config-QFPSL7Y2.js.map} +0 -0
- /package/dist/{chunk-VADACTVB.js.map → chunk-2RZWKIDU.js.map} +0 -0
- /package/dist/{chunk-QCSXKQTK.js.map → chunk-36BA6D6J.js.map} +0 -0
- /package/dist/{chunk-7J7UYJXC.js.map → chunk-4GSFZS6M.js.map} +0 -0
- /package/dist/{chunk-ERL3XHQO.js.map → chunk-AOBIUJX5.js.map} +0 -0
- /package/dist/{chunk-276GRITW.js.map → chunk-BTPPGHG3.js.map} +0 -0
- /package/dist/{chunk-II5NJRKH.js.map → chunk-CMQO6WEQ.js.map} +0 -0
- /package/dist/{chunk-WXU4Y5T3.js.map → chunk-D3TZZO6L.js.map} +0 -0
- /package/dist/{chunk-H5DTHO7O.js.map → chunk-DJFYMDMD.js.map} +0 -0
- /package/dist/{chunk-K2PVLCHR.js.map → chunk-DLVIES6W.js.map} +0 -0
- /package/dist/{chunk-3XQK4MEF.js.map → chunk-FDZ3SLMV.js.map} +0 -0
- /package/dist/{chunk-W6SM3MU5.js.map → chunk-FMKEGR6N.js.map} +0 -0
- /package/dist/{chunk-F2GERNMF.js.map → chunk-FOYSPWOA.js.map} +0 -0
- /package/dist/{chunk-TZWJ7QLW.js.map → chunk-HQ2A4DGU.js.map} +0 -0
- /package/dist/{chunk-3CLKYFE3.js.map → chunk-I3J7WUMV.js.map} +0 -0
- /package/dist/{chunk-64VMTY3M.js.map → chunk-K2GDWPVK.js.map} +0 -0
- /package/dist/{chunk-QY3HOLGD.js.map → chunk-KE5IGD6G.js.map} +0 -0
- /package/dist/{chunk-SNSPYZQT.js.map → chunk-MZUUIMRQ.js.map} +0 -0
- /package/dist/{chunk-7QQ5F7T5.js.map → chunk-OJSG734P.js.map} +0 -0
- /package/dist/{chunk-YQUM3UWK.js.map → chunk-P2DV7PDG.js.map} +0 -0
- /package/dist/{chunk-SQCFKQUR.js.map → chunk-P64GQUQW.js.map} +0 -0
- /package/dist/{chunk-GXLI2E4U.js.map → chunk-PCPQ75EC.js.map} +0 -0
- /package/dist/{chunk-Q5V3KTUL.js.map → chunk-Q55JVMUD.js.map} +0 -0
- /package/dist/{chunk-EALWAQAQ.js.map → chunk-S2B4UBHK.js.map} +0 -0
- /package/dist/{chunk-7AU5WLAJ.js.map → chunk-V7PXKAZD.js.map} +0 -0
- /package/dist/{chunk-FKKVZRSY.js.map → chunk-VQRXDFVF.js.map} +0 -0
- /package/dist/{chunk-6HETGJSB.js.map → chunk-WANBZFP2.js.map} +0 -0
- /package/dist/{chunk-ZGHJMFQ6.js.map → chunk-WFZARRYN.js.map} +0 -0
- /package/dist/{chunk-AOS7F4QR.js.map → chunk-WKYDGROH.js.map} +0 -0
- /package/dist/{cli-circuit-breaker-AAHYLFXZ.js.map → cli-circuit-breaker-BOZNYIZE.js.map} +0 -0
- /package/dist/{composite-router-VAVDLJGT.js.map → composite-router-NG7BLVVR.js.map} +0 -0
- /package/dist/{consensus-vote-L4CN33XE.js.map → consensus-vote-3FCOFDON.js.map} +0 -0
- /package/dist/{context-retriever-MYKBBDAN.js.map → context-retriever-QKMSSV6W.js.map} +0 -0
- /package/dist/{doctor-deep-AKOPPCXB.js.map → doctor-deep-CPMR6TDF.js.map} +0 -0
- /package/dist/{doctor-live-3PVIYQST.js.map → doctor-live-GWE5IA7D.js.map} +0 -0
- /package/dist/{expert-bridge-G3KN7QWL.js.map → expert-bridge-6WZ333NT.js.map} +0 -0
- /package/dist/{factory-KVMLFEWJ.js.map → factory-2DD2YGBU.js.map} +0 -0
- /package/dist/{factory-ROTP63IZ.js.map → factory-73WKMDVR.js.map} +0 -0
- /package/dist/{improvement-review-WTZ4JV5V.js.map → improvement-review-RMDGMKIB.js.map} +0 -0
- /package/dist/{init-opencode-C63LASGX.js.map → init-opencode-7PKVI3LD.js.map} +0 -0
- /package/dist/{issue-triage-PIE3YVCV.js.map → issue-triage-MLBUABPA.js.map} +0 -0
- /package/dist/{pr-reviewer-helpers-4VDGMGV5.js.map → pr-reviewer-helpers-7DSP3YTT.js.map} +0 -0
- /package/dist/{registry-command-IRDP2L2R.js.map → registry-command-YXFZ7LVE.js.map} +0 -0
- /package/dist/{repo-security-plan-NS47HQEF.js.map → repo-security-plan-M36GODNF.js.map} +0 -0
- /package/dist/{research-helpers-synthesize-5NBL637T.js.map → research-helpers-synthesize-7CI4MFYP.js.map} +0 -0
- /package/dist/{routing-memory-2IELT5GT.js.map → routing-memory-MIK3LGDH.js.map} +0 -0
- /package/dist/{session-memory-CH3CVLIT.js.map → session-memory-T2X4BM33.js.map} +0 -0
- /package/dist/{setup-config-MKZZDUJP.js.map → setup-config-6JSBY6OG.js.map} +0 -0
- /package/dist/{setup-custom-api-2I52S7XU.js.map → setup-custom-api-2OXG6ERI.js.map} +0 -0
- /package/dist/{setup-data-dir-NU3YBIZB.js.map → setup-data-dir-CWU367E6.js.map} +0 -0
- /package/dist/{tool-memory-STS3DWOK.js.map → tool-memory-AL3RAR67.js.map} +0 -0
- /package/dist/{unified-registry-NJS4ZWC3.js.map → unified-registry-5YUSIEML.js.map} +0 -0
- /package/dist/{weather-report-YG4T4Q23.js.map → weather-report-W34L4HW5.js.map} +0 -0
|
@@ -3,20 +3,20 @@ import {
|
|
|
3
3
|
DECISION_EMOJI,
|
|
4
4
|
SEVERITY_EMOJI,
|
|
5
5
|
SEVERITY_ORDER2 as SEVERITY_ORDER
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-3W4L63ML.js";
|
|
7
7
|
import {
|
|
8
8
|
allOf
|
|
9
9
|
} from "./chunk-OQB3XC5O.js";
|
|
10
10
|
import {
|
|
11
11
|
assessReputation,
|
|
12
|
-
gateWithReputation,
|
|
13
|
-
resolveReputationGatingMode,
|
|
14
12
|
sanitizeInput
|
|
15
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-M33EQB7P.js";
|
|
16
14
|
import {
|
|
17
15
|
createLogger,
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
err,
|
|
17
|
+
getTimeProvider,
|
|
18
|
+
ok
|
|
19
|
+
} from "./chunk-AOBIUJX5.js";
|
|
20
20
|
|
|
21
21
|
// src/dogfooding/pr-reviewer-helpers.ts
|
|
22
22
|
import { randomUUID } from "node:crypto";
|
|
@@ -43,12 +43,15 @@ function assessPRReputation(pr, cache, enableReputation, accountAgeDays) {
|
|
|
43
43
|
};
|
|
44
44
|
return assessReputation(metadata, cache);
|
|
45
45
|
}
|
|
46
|
-
function buildPRTrustAssessment(
|
|
46
|
+
function buildPRTrustAssessment(firewall, reputation, gateDecision) {
|
|
47
|
+
const trustResult = firewall.trust;
|
|
47
48
|
const isTier1 = trustResult.trustTier === "1";
|
|
48
49
|
return {
|
|
49
50
|
trustTier: trustResult.trustTier,
|
|
50
51
|
userRole: trustResult.userRole,
|
|
51
|
-
|
|
52
|
+
// Measured or absent (#4992): never the classifier's default `false`.
|
|
53
|
+
...firewall.isAllowlisted !== void 0 ? { isAllowlisted: firewall.isAllowlisted } : {},
|
|
54
|
+
auditSink: firewall.auditSink,
|
|
52
55
|
reputationScore: reputation?.reputationScore,
|
|
53
56
|
suspiciousSignals: isTier1 ? [] : reputation?.suspiciousSignals ?? [],
|
|
54
57
|
isSuspicious: isTier1 ? false : reputation?.isSuspicious ?? false,
|
|
@@ -57,13 +60,12 @@ function buildPRTrustAssessment(trustResult, reputation, gateDecision) {
|
|
|
57
60
|
gatingMode: gateDecision.mode
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
|
-
function gatePRAuthor(pr,
|
|
61
|
-
const
|
|
62
|
-
const gateDecision =
|
|
63
|
-
|
|
64
|
-
reputation
|
|
65
|
-
|
|
66
|
-
);
|
|
63
|
+
function gatePRAuthor(pr, firewall, reputation) {
|
|
64
|
+
const trustResult = firewall.trust;
|
|
65
|
+
const gateDecision = firewall.reputationGate;
|
|
66
|
+
if (gateDecision === void 0) {
|
|
67
|
+
return err(new Error("Untrusted-input firewall returned no reputation gate decision"));
|
|
68
|
+
}
|
|
67
69
|
if (gateDecision.demotionSuppressed) {
|
|
68
70
|
repLogger.warn("Reputation demotion suppressed by gating mode (would block under enforce)", {
|
|
69
71
|
prNumber: pr.number,
|
|
@@ -73,10 +75,10 @@ function gatePRAuthor(pr, trustResult, accountAgeDays, cache, enableReputation)
|
|
|
73
75
|
reconciledTier: gateDecision.reconciledTier
|
|
74
76
|
});
|
|
75
77
|
}
|
|
76
|
-
return {
|
|
78
|
+
return ok({
|
|
77
79
|
gateDecision,
|
|
78
|
-
trustAssessment: buildPRTrustAssessment(
|
|
79
|
-
};
|
|
80
|
+
trustAssessment: buildPRTrustAssessment(firewall, reputation, gateDecision)
|
|
81
|
+
});
|
|
80
82
|
}
|
|
81
83
|
function parseSeverity(value) {
|
|
82
84
|
if (typeof value === "string") {
|
|
@@ -303,4 +305,4 @@ export {
|
|
|
303
305
|
createFailedReview,
|
|
304
306
|
reviewPostingBlock
|
|
305
307
|
};
|
|
306
|
-
//# sourceMappingURL=chunk-
|
|
308
|
+
//# sourceMappingURL=chunk-UXCE2OBL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dogfooding/pr-reviewer-helpers.ts"],"sourcesContent":["/**\n * nexus-agents/dogfooding - PR Reviewer Helpers\n *\n * Helper functions for PR review formatting and aggregation.\n *\n * @module dogfooding/pr-reviewer-helpers\n * (Source: Issue #161, Alignment Roadmap Phase 3)\n */\n\nimport { randomUUID } from 'node:crypto';\nimport type { Result } from '../core/index.js';\nimport { getTimeProvider, createLogger, ok, err } from '../core/index.js';\nimport type { ScmUserMetadata } from '../scm/types.js';\nimport type {\n PRMetadata,\n PRReviewDraft,\n PRTrustAssessment,\n ExpertReviewResult,\n ReviewFinding,\n ReviewCategory,\n ReviewSeverity,\n ReviewDecision,\n} from './pr-review-types.js';\nimport {\n SEVERITY_ORDER,\n CATEGORY_DISPLAY_NAMES,\n SEVERITY_EMOJI,\n DECISION_EMOJI,\n} from './pr-review-types.js';\nimport { sanitizeInput } from '../security/input-sanitizer.js';\nimport { allOf } from '../utils/verdict-aggregation.js';\nimport { assessReputation } from '../security/reputation-model.js';\nimport type {\n ReputationCache,\n ReputationGateDecision,\n ReputationAssessment,\n GitHubUserMetadata,\n} from '../security/reputation-model.js';\nimport type { FirewallResult } from '../security/firewall/firewall-pipeline.js';\n\nconst repLogger = createLogger({ component: 'PRReviewer.reputation' });\n\n// =============================================================================\n// Reputation Gating Helpers (#3123, epic #3118 Phase 5)\n// =============================================================================\n\n/**\n * Best-effort account-age lookup for a PR author (#3133, Phase-3 equivalent for\n * the PR path). Returns the author's real account age in days via the provider's\n * `fetchUserMetadata`, or `undefined` on any failure (err Result, unparseable\n * `createdAt`, or an unexpected rejection) — never fabricated, never throws, so\n * the review is never blocked by this lookup.\n */\nexport async function fetchAccountAgeDays(\n provider: { fetchUserMetadata: (u: string) => Promise<Result<ScmUserMetadata, Error>> },\n username: string\n): Promise<number | undefined> {\n try {\n const result = await provider.fetchUserMetadata(username);\n if (!result.ok) return undefined;\n const createdMs = Date.parse(result.value.createdAt);\n if (!Number.isFinite(createdMs)) return undefined;\n return Math.floor((getTimeProvider().now() - createdMs) / 86_400_000);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Assesses the PR author's reputation from the signals available in the PR\n * event: author association + injection flags from the (sanitized) PR body, plus\n * the author's real account age when it was fetched (#3133). `accountAgeDays` is\n * OMITTED when the lookup failed — never fabricated, so the engine skips the\n * `new_account` signal. Returns undefined when reputation is disabled.\n */\nexport function assessPRReputation(\n pr: PRMetadata,\n cache: ReputationCache,\n enableReputation: boolean,\n accountAgeDays: number | undefined\n): ReputationAssessment | undefined {\n if (!enableReputation) return undefined;\n // Only `injectionFlags` is consumed here, and injection detection is\n // role-independent — the userRole arg ('unknown') and the sanitizer's own\n // trustTier output are intentionally irrelevant to this call.\n const sanitizeResult = sanitizeInput(pr.body, 'unknown', pr.author);\n const metadata: GitHubUserMetadata = {\n username: pr.author,\n ...(accountAgeDays !== undefined ? { accountAgeDays } : {}),\n authorAssociation: pr.authorAssociation,\n injectionFlags: sanitizeResult.injectionFlags,\n };\n return assessReputation(metadata, cache);\n}\n\n/** Builds the observability assessment surfaced on the review result (#3123). */\nexport function buildPRTrustAssessment(\n firewall: Pick<FirewallResult, 'trust' | 'isAllowlisted' | 'auditSink'>,\n reputation: ReputationAssessment | undefined,\n gateDecision: ReputationGateDecision\n): PRTrustAssessment {\n const trustResult = firewall.trust;\n // Tier-1 (owner/allowlisted) authors cannot be suspicious.\n const isTier1 = trustResult.trustTier === '1';\n return {\n trustTier: trustResult.trustTier,\n userRole: trustResult.userRole,\n // Measured or absent (#4992): never the classifier's default `false`.\n ...(firewall.isAllowlisted !== undefined ? { isAllowlisted: firewall.isAllowlisted } : {}),\n auditSink: firewall.auditSink,\n reputationScore: reputation?.reputationScore,\n suspiciousSignals: isTier1 ? [] : (reputation?.suspiciousSignals ?? []),\n isSuspicious: isTier1 ? false : (reputation?.isSuspicious ?? false),\n enforcedTrustTier: gateDecision.enforcedTier,\n reputationReconciledTier: gateDecision.reconciledTier,\n gatingMode: gateDecision.mode,\n };\n}\n\n/**\n * Reads the reputation gate decision the firewall computed for this PR (#3123\n * gating; #4992 review: ONE gate, shared with the firewall's Rule-of-Two\n * signal) and builds the assessment surfaced on the result. A suppressed\n * demotion (audit/off) is logged. Fails closed when the firewall returned no\n * gate — structurally unreachable, since the caller always supplies the\n * reputation option, but the classifier tier must never stand in for it.\n */\nexport function gatePRAuthor(\n pr: PRMetadata,\n firewall: Pick<FirewallResult, 'trust' | 'isAllowlisted' | 'auditSink' | 'reputationGate'>,\n reputation: ReputationAssessment | undefined\n): Result<{ gateDecision: ReputationGateDecision; trustAssessment: PRTrustAssessment }, Error> {\n const trustResult = firewall.trust;\n const gateDecision = firewall.reputationGate;\n if (gateDecision === undefined) {\n return err(new Error('Untrusted-input firewall returned no reputation gate decision'));\n }\n if (gateDecision.demotionSuppressed) {\n repLogger.warn('Reputation demotion suppressed by gating mode (would block under enforce)', {\n prNumber: pr.number,\n author: pr.author,\n mode: gateDecision.mode,\n classifierTier: trustResult.trustTier,\n reconciledTier: gateDecision.reconciledTier,\n });\n }\n return ok({\n gateDecision,\n trustAssessment: buildPRTrustAssessment(firewall, reputation, gateDecision),\n });\n}\n\n// =============================================================================\n// Parsing Helpers\n// =============================================================================\n\nexport function parseSeverity(value: unknown): ReviewSeverity {\n if (typeof value === 'string') {\n const lower = value.toLowerCase();\n if (lower in SEVERITY_ORDER) return lower as ReviewSeverity;\n }\n return 'medium';\n}\n\nexport function parseCategory(value: unknown): ReviewCategory {\n if (typeof value === 'string') {\n const lower = value.toLowerCase();\n if (lower in CATEGORY_DISPLAY_NAMES) return lower as ReviewCategory;\n }\n return 'code_quality';\n}\n\nexport function extractSummary(output: Record<string, unknown>): string {\n if (typeof output.summary === 'string') return output.summary;\n if (typeof output.content === 'string') return output.content;\n if (typeof output.message === 'string') return output.message;\n return 'Review completed';\n}\n\nexport function extractStringField(\n record: Record<string, unknown>,\n ...keys: string[]\n): string | undefined {\n for (const key of keys) {\n const value = record[key];\n if (typeof value === 'string') return value;\n }\n return undefined;\n}\n\n// =============================================================================\n// Finding Parsing\n// =============================================================================\n\nexport function parseFindings(\n output: Record<string, unknown>,\n expertId: string,\n minSeverity: ReviewSeverity\n): ReviewFinding[] {\n const minOrder = SEVERITY_ORDER[minSeverity];\n const sources = collectSources(output);\n\n const findings: ReviewFinding[] = [];\n for (const source of sources) {\n if (!Array.isArray(source)) continue;\n for (const item of source) {\n const finding = parseOneFinding(item, expertId, minOrder);\n if (finding !== null) findings.push(finding);\n }\n }\n return findings;\n}\n\nfunction collectSources(output: Record<string, unknown>): unknown[] {\n return [\n output.findings,\n output.vulnerabilities,\n output.issues,\n (output as { content?: { findings?: unknown } }).content,\n ];\n}\n\nfunction parseOneFinding(item: unknown, expertId: string, minOrder: number): ReviewFinding | null {\n if (typeof item !== 'object' || item === null) return null;\n\n const record = item as Record<string, unknown>;\n const severity = parseSeverity(record.severity);\n if (SEVERITY_ORDER[severity] < minOrder) return null;\n\n return {\n id: randomUUID(),\n category: parseCategory(record.category),\n severity,\n title: extractStringField(record, 'title', 'name') ?? 'Finding',\n description: extractStringField(record, 'description', 'message') ?? '',\n file: typeof record.file === 'string' ? record.file : undefined,\n line: typeof record.line === 'number' ? record.line : undefined,\n suggestion: typeof record.suggestion === 'string' ? record.suggestion : undefined,\n expertId,\n confidence: typeof record.confidence === 'number' ? record.confidence : 0.7,\n };\n}\n\n// =============================================================================\n// Decision Helpers\n// =============================================================================\n\nexport function determineApproval(findings: ReviewFinding[]): boolean {\n const hasBlocking = findings.some((f) => f.severity === 'critical' || f.severity === 'high');\n return !hasBlocking;\n}\n\nexport function determineDecision(\n reviews: ExpertReviewResult[],\n findings: ReviewFinding[]\n): ReviewDecision {\n // #5012: an expert that errored produced no verdict, so it can neither\n // approve nor object. `allOf(reviews, …, false)` already refuses to call\n // ZERO reviews unanimous approval (#4581); feeding it synthetic approvals\n // for failed experts defeated that guard by making the list non-empty.\n const verdicts = reviews.filter((r) => r.errored !== true);\n const hasCritical = findings.some((f) => f.severity === 'critical');\n const hasHigh = findings.some((f) => f.severity === 'high');\n // Zero expert reviews is not unanimous approval (#4581): with `true` here the\n // `hasHigh && !allApproved` branch could never fire on an unreviewed PR, so a\n // HIGH finding silently downgraded from request_changes to comment.\n const allApproved = allOf(verdicts, (r) => r.approved, false);\n\n if (hasCritical) return 'request_changes';\n if (hasHigh && !allApproved) return 'request_changes';\n if (findings.length > 0) return 'comment';\n // Nothing read the diff, so there is nothing to approve. `comment` posts the\n // failure summaries without asserting the change is fine.\n if (verdicts.length === 0) return 'comment';\n return 'approve';\n}\n\nexport function calculateConsensus(reviews: ExpertReviewResult[]): number {\n if (reviews.length === 0) return 1;\n const approvals = reviews.filter((r) => r.approved).length;\n return approvals / reviews.length;\n}\n\n// =============================================================================\n// Counting Helpers\n// =============================================================================\n\nexport function countBySeverity(findings: ReviewFinding[]): Record<ReviewSeverity, number> {\n const counts: Record<ReviewSeverity, number> = {\n critical: 0,\n high: 0,\n medium: 0,\n low: 0,\n info: 0,\n };\n\n for (const f of findings) {\n counts[f.severity]++;\n }\n\n return counts;\n}\n\nexport function countByCategory(findings: ReviewFinding[]): Record<ReviewCategory, number> {\n const counts: Record<ReviewCategory, number> = {\n security: 0,\n performance: 0,\n code_quality: 0,\n testing: 0,\n documentation: 0,\n architecture: 0,\n };\n\n for (const f of findings) {\n counts[f.category]++;\n }\n\n return counts;\n}\n\nexport function sumFindings(counts: Record<ReviewSeverity, number>): number {\n return Object.values(counts).reduce((a, b) => a + b, 0);\n}\n\n// =============================================================================\n// Summary Generation\n// =============================================================================\n\nexport function generateSummary(\n pr: PRMetadata,\n reviews: ExpertReviewResult[],\n decision: ReviewDecision\n): string {\n const expertSummaries = reviews\n .map((r) => `- **${CATEGORY_DISPLAY_NAMES[r.expertType as ReviewCategory]}**: ${r.summary}`)\n .join('\\n');\n\n return `Reviewed PR #${String(pr.number)}: ${pr.title}\n\n**Decision:** ${decision.replaceAll('_', ' ')}\n**Experts consulted:** ${String(reviews.length)}\n\n${expertSummaries}`;\n}\n\n// =============================================================================\n// GitHub Comment Formatting\n// =============================================================================\n\n/**\n * Formats the review result as a GitHub comment.\n */\nexport function formatReviewComment(result: PRReviewDraft): string {\n const emoji = DECISION_EMOJI[result.decision];\n const decisionText = result.decision.replaceAll('_', ' ').toUpperCase();\n\n const findingsSection = formatFindingsSection(result);\n const statsSection = formatStatsSection(result);\n\n return `## ${emoji} Nexus Agents Review: ${decisionText}\n\n${result.summary}\n\n${findingsSection}\n\n${statsSection}\n\n---\n*Reviewed by [nexus-agents](https://github.com/nexus-substrate/nexus-agents) in ${String(result.totalDurationMs)}ms*`;\n}\n\nfunction formatFindingsSection(result: PRReviewDraft): string {\n const allFindings = result.expertReviews.flatMap((r) => r.findings);\n\n if (allFindings.length === 0) {\n return '_No issues found._';\n }\n\n const sorted = [...allFindings].sort(\n (a, b) => SEVERITY_ORDER[b.severity] - SEVERITY_ORDER[a.severity]\n );\n\n const lines = ['### Findings', ''];\n\n for (const f of sorted) {\n const emoji = SEVERITY_EMOJI[f.severity];\n const loc =\n f.file !== undefined\n ? ` (\\`${f.file}${f.line !== undefined ? `:${String(f.line)}` : ''}\\`)`\n : '';\n lines.push(`${emoji} **${f.title}**${loc}`);\n lines.push(`> ${f.description}`);\n if (f.suggestion !== undefined) {\n lines.push(`> 💡 ${f.suggestion}`);\n }\n lines.push('');\n }\n\n return lines.join('\\n');\n}\n\nfunction formatStatsSection(result: PRReviewDraft): string {\n const { findingsBySeverity } = result;\n const total = sumFindings(findingsBySeverity);\n\n const parts: string[] = [];\n for (const severity of ['critical', 'high', 'medium', 'low', 'info'] as ReviewSeverity[]) {\n const count = findingsBySeverity[severity];\n if (count > 0) {\n parts.push(`${SEVERITY_EMOJI[severity]} ${String(count)} ${severity}`);\n }\n }\n\n return `<details>\n<summary>Review Statistics (${String(total)} findings)</summary>\n\n- Experts: ${String(result.expertCount)}\n- Consensus: ${(result.consensusScore * 100).toFixed(0)}%\n- Duration: ${String(result.totalDurationMs)}ms\n- Findings: ${parts.join(', ') || 'none'}\n\n</details>`;\n}\n\n// =============================================================================\n// Failed Review Factory\n// =============================================================================\n\nexport function createFailedReview(\n expertId: string,\n category: ReviewCategory,\n durationMs: number,\n error: string\n): ExpertReviewResult {\n return {\n expertId,\n expertType: category,\n // #5012: NOT `approved: true`. \"Don't block on failures\" made an expert\n // that never ran indistinguishable from one that read the diff and had no\n // objection, and `determineDecision` turned three of those into an APPROVE\n // posted to GitHub.\n approved: false,\n errored: true,\n summary: `Review failed: ${error}`,\n findings: [],\n durationMs,\n confidence: 0,\n };\n}\n\n/** The policy gate's verdict on posting a review, as the caller needs it. */\ninterface ReviewPostingVerdict {\n readonly allowed: boolean;\n readonly hasRuleOfTwoViolation: boolean;\n readonly violations: readonly { rule: string }[];\n}\n\n/**\n * Decide whether review posting is blocked, and how to describe it.\n *\n * Consumes the gate's own `allowed` rather than re-deriving a narrower\n * condition. The caller previously blocked on `hasRuleOfTwoViolation` alone\n * while `evaluatePolicy` had already computed `allowed`.\n *\n * For the action `auditReviewAction` builds, the two are currently EQUIVALENT:\n * tiers 1-2 yield no violations, tiers 3-4 yield INSUFFICIENT_TRUST +\n * UNTRUSTED_INFLUENCE + RULE_OF_TWO together. So this changes no behaviour\n * today. It makes the equivalence guaranteed rather than accidental — it holds\n * only because that context hardcodes `hasWriteAccess` and `hasSecretAccess`\n * to true, which is what makes `checkRuleOfTwo` fire at tier 3+. Make either\n * conditional and RULE_OF_TWO stops firing while the other two blocking rules\n * still do, and a review would post against `allowed: false`.\n *\n * Returns `undefined` when posting may proceed. Rule of Two keeps its own\n * label: it is the distinctive condition (untrusted input + write access +\n * secrets at once) and reads very differently from a trust-tier block.\n */\nexport function reviewPostingBlock(\n verdict: ReviewPostingVerdict\n): { label: string; reason: string } | undefined {\n if (verdict.allowed) return undefined;\n const label = verdict.hasRuleOfTwoViolation ? 'Rule of Two' : 'Policy gate';\n return { label, reason: `${label}: ${verdict.violations.map((v) => v.rule).join(', ')}` };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AASA,SAAS,kBAAkB;AA+B3B,IAAM,YAAY,aAAa,EAAE,WAAW,wBAAwB,CAAC;AAarE,eAAsB,oBACpB,UACA,UAC6B;AAC7B,MAAI;AACF,UAAM,SAAS,MAAM,SAAS,kBAAkB,QAAQ;AACxD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AAY,QAAQ,UAAU,OAAO,MAAM,GAAuB;AACxF,UAAM,QAAQ,mBAAmB,QAAQ;AACzC,QAAI,QAAQ,GAAG;AACb,YAAM,KAAK,GAAG,eAAe,QAAQ,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,QAAQ,EAAE;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AAAA,8BACqB,OAAO,KAAK,CAAC;AAAA;AAAA,aAE9B,OAAO,OAAO,WAAW,CAAC;AAAA,gBACvB,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC;AAAA,cACzC,OAAO,OAAO,eAAe,CAAC;AAAA,cAC9B,MAAM,KAAK,IAAI,KAAK,MAAM;AAAA;AAAA;AAGxC;AAMO,SAAS,mBACd,UACA,UACA,YACA,OACoB;AACpB,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA;AAAA;AAAA;AAAA;AAAA,IAKZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS,kBAAkB,KAAK;AAAA,IAChC,UAAU,CAAC;AAAA,IACX;AAAA,IACA,YAAY;AAAA,EACd;AACF;AA6BO,SAAS,mBACd,SAC+C;AAC/C,MAAI,QAAQ,QAAS,QAAO;AAC5B,QAAM,QAAQ,QAAQ,wBAAwB,gBAAgB;AAC9D,SAAO,EAAE,OAAO,QAAQ,GAAG,KAAK,KAAK,QAAQ,WAAW,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC,GAAG;AAC1F;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
createLogger,
|
|
6
6
|
getTimeProvider
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AOBIUJX5.js";
|
|
8
8
|
|
|
9
9
|
// src/mcp/tools/scanner-registry-fetcher.ts
|
|
10
10
|
import { z } from "zod";
|
|
@@ -721,4 +721,4 @@ export {
|
|
|
721
721
|
generateSecurityPlan,
|
|
722
722
|
buildPlanFromAnalysis
|
|
723
723
|
};
|
|
724
|
-
//# sourceMappingURL=chunk-
|
|
724
|
+
//# sourceMappingURL=chunk-V7PXKAZD.js.map
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
lookupInTreeCapability,
|
|
14
14
|
ok,
|
|
15
15
|
resolveRetryAfterMs
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-AOBIUJX5.js";
|
|
17
17
|
|
|
18
18
|
// src/config/model-parameter-support.ts
|
|
19
19
|
function parseClaudeMajorMinor(bareId) {
|
|
@@ -834,4 +834,4 @@ export {
|
|
|
834
834
|
DEFAULT_COLLECT_STREAM_MAX_CHUNKS,
|
|
835
835
|
collectStream
|
|
836
836
|
};
|
|
837
|
-
//# sourceMappingURL=chunk-
|
|
837
|
+
//# sourceMappingURL=chunk-VQRXDFVF.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createLogger,
|
|
4
4
|
getDefaultRegistry,
|
|
5
5
|
roundToMicroUsd
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AOBIUJX5.js";
|
|
7
7
|
import {
|
|
8
8
|
getNexusDataDir
|
|
9
9
|
} from "./chunk-J7QCZRVK.js";
|
|
@@ -176,4 +176,4 @@ export {
|
|
|
176
176
|
loadUsageEvents,
|
|
177
177
|
rollupByModel
|
|
178
178
|
};
|
|
179
|
-
//# sourceMappingURL=chunk-
|
|
179
|
+
//# sourceMappingURL=chunk-WANBZFP2.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPapersRegistry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-I3J7WUMV.js";
|
|
4
4
|
import {
|
|
5
5
|
getErrorMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-AOBIUJX5.js";
|
|
7
7
|
|
|
8
8
|
// src/cli/research-helpers-synthesize.ts
|
|
9
9
|
import { z } from "zod";
|
|
@@ -886,4 +886,4 @@ export {
|
|
|
886
886
|
AttributedInsightSchema,
|
|
887
887
|
synthesizeResearch
|
|
888
888
|
};
|
|
889
|
-
//# sourceMappingURL=chunk-
|
|
889
|
+
//# sourceMappingURL=chunk-WFZARRYN.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
TASK_CATEGORIES,
|
|
3
3
|
getAdaptiveBonus,
|
|
4
4
|
getOutcomeStore
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-AOBIUJX5.js";
|
|
6
6
|
|
|
7
7
|
// src/cli/doctor-deep.ts
|
|
8
8
|
var CLI_NAMES = ["claude", "gemini", "codex", "opencode"];
|
|
@@ -106,4 +106,4 @@ export {
|
|
|
106
106
|
runDeepDiagnostics,
|
|
107
107
|
formatDeepDiagnostics
|
|
108
108
|
};
|
|
109
|
-
//# sourceMappingURL=chunk-
|
|
109
|
+
//# sourceMappingURL=chunk-WKYDGROH.js.map
|
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
createCliCircuitBreakerIntegration,
|
|
4
4
|
getCliCircuitBreakerSnapshot,
|
|
5
5
|
getDefaultCliCircuitBreakerRegistry
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-2RZWKIDU.js";
|
|
7
|
+
import "./chunk-AOBIUJX5.js";
|
|
8
8
|
import "./chunk-7WJGV5DN.js";
|
|
9
9
|
import "./chunk-J7QCZRVK.js";
|
|
10
10
|
import "./chunk-ZPWHCABL.js";
|
|
@@ -14,4 +14,4 @@ export {
|
|
|
14
14
|
getCliCircuitBreakerSnapshot,
|
|
15
15
|
getDefaultCliCircuitBreakerRegistry
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=cli-circuit-breaker-
|
|
17
|
+
//# sourceMappingURL=cli-circuit-breaker-BOZNYIZE.js.map
|
package/dist/cli.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
formatDetectionMessage
|
|
6
6
|
} from "./chunk-4QHAMZLU.js";
|
|
7
7
|
import {
|
|
8
|
+
assessPRReputation,
|
|
8
9
|
calculateConsensus,
|
|
9
10
|
countByCategory,
|
|
10
11
|
countBySeverity,
|
|
@@ -19,11 +20,11 @@ import {
|
|
|
19
20
|
parseFindings,
|
|
20
21
|
reviewPostingBlock,
|
|
21
22
|
sumFindings
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-UXCE2OBL.js";
|
|
24
|
+
import "./chunk-WKYDGROH.js";
|
|
24
25
|
import {
|
|
25
26
|
runConfigInitSync
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-K2GDWPVK.js";
|
|
27
28
|
import {
|
|
28
29
|
AuthHandler,
|
|
29
30
|
CustomExpertDefinitionSchema,
|
|
@@ -153,15 +154,15 @@ import {
|
|
|
153
154
|
validateNexusEnv,
|
|
154
155
|
validateWorkflow,
|
|
155
156
|
wrapInMarkdownFence
|
|
156
|
-
} from "./chunk-
|
|
157
|
-
import "./chunk-
|
|
157
|
+
} from "./chunk-MYERGZK3.js";
|
|
158
|
+
import "./chunk-V7PXKAZD.js";
|
|
158
159
|
import "./chunk-DGWT7DXX.js";
|
|
159
160
|
import "./chunk-64GMIUM5.js";
|
|
160
|
-
import "./chunk-
|
|
161
|
+
import "./chunk-FDZ3SLMV.js";
|
|
161
162
|
import {
|
|
162
163
|
CATEGORY_DISPLAY_NAMES,
|
|
163
164
|
DEFAULT_PR_REVIEW_CONFIG
|
|
164
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-3W4L63ML.js";
|
|
165
166
|
import {
|
|
166
167
|
DATA_SUBDIRECTORIES,
|
|
167
168
|
checkApiKeys,
|
|
@@ -173,14 +174,14 @@ import {
|
|
|
173
174
|
doctorCommand,
|
|
174
175
|
initDataDirectories,
|
|
175
176
|
runDoctor
|
|
176
|
-
} from "./chunk-
|
|
177
|
+
} from "./chunk-KE5IGD6G.js";
|
|
177
178
|
import {
|
|
178
179
|
buildOpenAICompatAdapters,
|
|
179
180
|
readOpenAICompatEnv
|
|
180
|
-
} from "./chunk-
|
|
181
|
+
} from "./chunk-MZUUIMRQ.js";
|
|
181
182
|
import {
|
|
182
183
|
shutdownExpertBridge
|
|
183
|
-
} from "./chunk-
|
|
184
|
+
} from "./chunk-4GSFZS6M.js";
|
|
184
185
|
import {
|
|
185
186
|
ConsensusVoteInputSchema,
|
|
186
187
|
DEFAULT_VOTE_TIMEOUT_MS,
|
|
@@ -192,29 +193,30 @@ import {
|
|
|
192
193
|
recordAuthenticVote,
|
|
193
194
|
registerConsensusVoteTool,
|
|
194
195
|
toRecordDecision
|
|
195
|
-
} from "./chunk-
|
|
196
|
+
} from "./chunk-P64GQUQW.js";
|
|
196
197
|
import {
|
|
197
198
|
loadUsageEvents,
|
|
198
199
|
rollupByModel
|
|
199
|
-
} from "./chunk-
|
|
200
|
+
} from "./chunk-WANBZFP2.js";
|
|
200
201
|
import {
|
|
201
202
|
allOf,
|
|
202
203
|
anyOf
|
|
203
204
|
} from "./chunk-OQB3XC5O.js";
|
|
204
205
|
import {
|
|
205
206
|
synthesizeResearch
|
|
206
|
-
} from "./chunk-
|
|
207
|
+
} from "./chunk-WFZARRYN.js";
|
|
207
208
|
import {
|
|
208
|
-
|
|
209
|
+
configureUntrustedInputFirewall,
|
|
209
210
|
createFullGitHubProvider,
|
|
210
211
|
evaluatePolicy,
|
|
211
|
-
parsePRUrl
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
parsePRUrl,
|
|
213
|
+
runUntrustedInputFirewall
|
|
214
|
+
} from "./chunk-FPHFCZ2E.js";
|
|
215
|
+
import "./chunk-Q55JVMUD.js";
|
|
214
216
|
import {
|
|
215
217
|
ReputationCache,
|
|
216
218
|
sanitizeInput
|
|
217
|
-
} from "./chunk-
|
|
219
|
+
} from "./chunk-M33EQB7P.js";
|
|
218
220
|
import {
|
|
219
221
|
ImprovementReviewInputSchema,
|
|
220
222
|
calculateFitnessScore,
|
|
@@ -228,20 +230,20 @@ import {
|
|
|
228
230
|
registerImprovementReviewTool,
|
|
229
231
|
runImprovementReview,
|
|
230
232
|
scanForSecrets
|
|
231
|
-
} from "./chunk-
|
|
233
|
+
} from "./chunk-FMKEGR6N.js";
|
|
232
234
|
import {
|
|
233
235
|
createDefaultPolicyFirewall,
|
|
234
236
|
setGlobalPolicyFirewall,
|
|
235
237
|
stagePolicyFirewallForRollout
|
|
236
|
-
} from "./chunk-
|
|
238
|
+
} from "./chunk-P2DV7PDG.js";
|
|
237
239
|
import {
|
|
238
240
|
VERSION
|
|
239
|
-
} from "./chunk-
|
|
240
|
-
import "./chunk-
|
|
241
|
+
} from "./chunk-DJFYMDMD.js";
|
|
242
|
+
import "./chunk-46YGVSBD.js";
|
|
241
243
|
import {
|
|
242
244
|
createUnifiedRegistry,
|
|
243
245
|
getGlobalRegistry
|
|
244
|
-
} from "./chunk-
|
|
246
|
+
} from "./chunk-BTPPGHG3.js";
|
|
245
247
|
import {
|
|
246
248
|
CodebaseIndexSchema,
|
|
247
249
|
PaperStatusSchema,
|
|
@@ -267,24 +269,24 @@ import {
|
|
|
267
269
|
loadSourcesRegistry,
|
|
268
270
|
rankDiscoveredItems,
|
|
269
271
|
saveSourcesRegistry
|
|
270
|
-
} from "./chunk-
|
|
272
|
+
} from "./chunk-S2B4UBHK.js";
|
|
271
273
|
import {
|
|
272
274
|
loadPapersRegistry,
|
|
273
275
|
loadTechniquesRegistry,
|
|
274
276
|
savePapersRegistry
|
|
275
|
-
} from "./chunk-
|
|
277
|
+
} from "./chunk-I3J7WUMV.js";
|
|
276
278
|
import {
|
|
277
279
|
resolveToken
|
|
278
|
-
} from "./chunk-
|
|
280
|
+
} from "./chunk-CMQO6WEQ.js";
|
|
279
281
|
import {
|
|
280
282
|
MemoryError,
|
|
281
283
|
shutdownToolMemory
|
|
282
|
-
} from "./chunk-
|
|
284
|
+
} from "./chunk-SGOBMAZK.js";
|
|
283
285
|
import {
|
|
284
286
|
capitalize,
|
|
285
287
|
capitalizeKebab
|
|
286
288
|
} from "./chunk-6T3EPABN.js";
|
|
287
|
-
import "./chunk-
|
|
289
|
+
import "./chunk-DLVIES6W.js";
|
|
288
290
|
import {
|
|
289
291
|
BUILT_IN_EXPERTS
|
|
290
292
|
} from "./chunk-43SVUIPL.js";
|
|
@@ -297,19 +299,19 @@ import {
|
|
|
297
299
|
isRecord,
|
|
298
300
|
probeAllClis,
|
|
299
301
|
readSubprocessDepth
|
|
300
|
-
} from "./chunk-
|
|
301
|
-
import "./chunk-
|
|
302
|
+
} from "./chunk-OJSG734P.js";
|
|
303
|
+
import "./chunk-VQRXDFVF.js";
|
|
302
304
|
import {
|
|
303
305
|
DEFAULTS
|
|
304
|
-
} from "./chunk-
|
|
305
|
-
import "./chunk-
|
|
306
|
+
} from "./chunk-36BA6D6J.js";
|
|
307
|
+
import "./chunk-FOYSPWOA.js";
|
|
306
308
|
import {
|
|
307
309
|
nexusMkdtempSync
|
|
308
310
|
} from "./chunk-DKHBIJO4.js";
|
|
309
|
-
import "./chunk-
|
|
311
|
+
import "./chunk-HQ2A4DGU.js";
|
|
310
312
|
import "./chunk-QZUG667L.js";
|
|
311
|
-
import "./chunk-
|
|
312
|
-
import "./chunk-
|
|
313
|
+
import "./chunk-D3TZZO6L.js";
|
|
314
|
+
import "./chunk-2RZWKIDU.js";
|
|
313
315
|
import {
|
|
314
316
|
API_TIMEOUTS,
|
|
315
317
|
AgentCapability,
|
|
@@ -387,7 +389,7 @@ import {
|
|
|
387
389
|
validateTimeout,
|
|
388
390
|
writeEmptyLine,
|
|
389
391
|
writeLine
|
|
390
|
-
} from "./chunk-
|
|
392
|
+
} from "./chunk-AOBIUJX5.js";
|
|
391
393
|
import "./chunk-7WJGV5DN.js";
|
|
392
394
|
import {
|
|
393
395
|
applyPortableMode,
|
|
@@ -4175,6 +4177,7 @@ function handleModeCommand(args) {
|
|
|
4175
4177
|
|
|
4176
4178
|
// src/dogfooding/pr-reviewer.ts
|
|
4177
4179
|
var logger5 = createLogger({ component: "PRReviewer" });
|
|
4180
|
+
var REVIEW_ACCESS_CONTEXT = { hasWriteAccess: true, hasSecretAccess: true };
|
|
4178
4181
|
var PRReviewer = class {
|
|
4179
4182
|
config;
|
|
4180
4183
|
observer;
|
|
@@ -4199,21 +4202,26 @@ var PRReviewer = class {
|
|
|
4199
4202
|
const fetchResult = await this.fetchPRData(owner, repo, prNumber);
|
|
4200
4203
|
if (!fetchResult.ok) return fetchResult;
|
|
4201
4204
|
const { metadata: prMetadata, provider, accountAgeDays } = fetchResult.value;
|
|
4202
|
-
const
|
|
4205
|
+
const reputation = assessPRReputation(
|
|
4206
|
+
prMetadata,
|
|
4207
|
+
this.reputationCache,
|
|
4208
|
+
this.config.enableReputation,
|
|
4209
|
+
accountAgeDays
|
|
4210
|
+
);
|
|
4211
|
+
const firewall = this.classifyPRAuthor(prMetadata, reputation);
|
|
4212
|
+
if (!firewall.ok) return firewall;
|
|
4213
|
+
const trustResult = firewall.value.trust;
|
|
4203
4214
|
logger5.info("PR author trust classified", {
|
|
4204
4215
|
prNumber,
|
|
4205
4216
|
author: prMetadata.author,
|
|
4206
4217
|
trustTier: trustResult.trustTier,
|
|
4207
4218
|
userRole: trustResult.userRole,
|
|
4208
|
-
|
|
4219
|
+
// Logged only when measured (#4992).
|
|
4220
|
+
...firewall.value.isAllowlisted !== void 0 ? { isAllowlisted: firewall.value.isAllowlisted } : {}
|
|
4209
4221
|
});
|
|
4210
|
-
const
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
accountAgeDays,
|
|
4214
|
-
this.reputationCache,
|
|
4215
|
-
this.config.enableReputation
|
|
4216
|
-
);
|
|
4222
|
+
const gated = gatePRAuthor(prMetadata, firewall.value, reputation);
|
|
4223
|
+
if (!gated.ok) return gated;
|
|
4224
|
+
const { gateDecision, trustAssessment } = gated.value;
|
|
4217
4225
|
const expertReviews = await this.runExpertReviews(prMetadata, traceId);
|
|
4218
4226
|
const result = this.aggregateReviews(prMetadata, expertReviews, startTime, trustAssessment);
|
|
4219
4227
|
const postOutcome = this.config.dryRun ? { status: "skipped", reason: "dry-run" } : await this.postReviewToGitHub(provider, parseResult.value, result, gateDecision);
|
|
@@ -4296,14 +4304,24 @@ var PRReviewer = class {
|
|
|
4296
4304
|
};
|
|
4297
4305
|
}
|
|
4298
4306
|
/**
|
|
4299
|
-
* Classifies the PR author's trust tier
|
|
4300
|
-
*
|
|
4307
|
+
* Classifies the PR author's trust tier through the shared firewall (#4992;
|
|
4308
|
+
* originally Issue #828 — Wire security modules into production pipeline).
|
|
4309
|
+
*
|
|
4310
|
+
* No maintainer allowlist is passed: there is no source for one today (no
|
|
4311
|
+
* config field, no env var), so none is consulted and `isAllowlisted` stays
|
|
4312
|
+
* absent on the result rather than being recorded as `false`.
|
|
4301
4313
|
*/
|
|
4302
|
-
classifyPRAuthor(pr) {
|
|
4303
|
-
return
|
|
4304
|
-
|
|
4305
|
-
|
|
4306
|
-
|
|
4314
|
+
classifyPRAuthor(pr, reputation) {
|
|
4315
|
+
return runUntrustedInputFirewall(
|
|
4316
|
+
{
|
|
4317
|
+
type: "pull_request",
|
|
4318
|
+
username: pr.author,
|
|
4319
|
+
authorAssociation: pr.authorAssociation,
|
|
4320
|
+
title: pr.title,
|
|
4321
|
+
body: pr.body
|
|
4322
|
+
},
|
|
4323
|
+
{ context: REVIEW_ACCESS_CONTEXT, reputation: { assessment: reputation } }
|
|
4324
|
+
);
|
|
4307
4325
|
}
|
|
4308
4326
|
/**
|
|
4309
4327
|
* Sanitizes untrusted PR content (body/title) before embedding in expert tasks.
|
|
@@ -4460,7 +4478,7 @@ ${file.patch}
|
|
|
4460
4478
|
violations: policyResult.violations
|
|
4461
4479
|
});
|
|
4462
4480
|
}
|
|
4463
|
-
const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-
|
|
4481
|
+
const { formatReviewComment: formatReviewComment2 } = await import("./pr-reviewer-helpers-7DSP3YTT.js");
|
|
4464
4482
|
const body = formatReviewComment2(result);
|
|
4465
4483
|
const postResult = await provider.createReview(pr.prNumber, body, result.decision);
|
|
4466
4484
|
if (!postResult.ok) {
|
|
@@ -4476,8 +4494,7 @@ ${file.patch}
|
|
|
4476
4494
|
auditReviewAction(enforcedTier) {
|
|
4477
4495
|
const context = {
|
|
4478
4496
|
inputTrustTier: enforcedTier,
|
|
4479
|
-
|
|
4480
|
-
hasSecretAccess: true
|
|
4497
|
+
...REVIEW_ACCESS_CONTEXT
|
|
4481
4498
|
};
|
|
4482
4499
|
const decision = evaluatePolicy(
|
|
4483
4500
|
{
|
|
@@ -11855,7 +11872,7 @@ function probeGrammars(register, parse6, probes = GRAMMAR_PROBES) {
|
|
|
11855
11872
|
}
|
|
11856
11873
|
async function loadGrammarModules() {
|
|
11857
11874
|
const [{ ensurePolyglotLangs }, napi] = await Promise.all([
|
|
11858
|
-
import("./ast-rule-runner-
|
|
11875
|
+
import("./ast-rule-runner-BEUFFQWL.js"),
|
|
11859
11876
|
import("@ast-grep/napi")
|
|
11860
11877
|
]);
|
|
11861
11878
|
return { register: ensurePolyglotLangs, parse: napi.parse };
|
|
@@ -19667,7 +19684,7 @@ function startImprovementReviewScheduler(options) {
|
|
|
19667
19684
|
let running = false;
|
|
19668
19685
|
const runOnce = async () => {
|
|
19669
19686
|
try {
|
|
19670
|
-
const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-
|
|
19687
|
+
const { runImprovementReview: runImprovementReview2, ImprovementReviewInputSchema: ImprovementReviewInputSchema2 } = await import("./improvement-review-RMDGMKIB.js");
|
|
19671
19688
|
const input = ImprovementReviewInputSchema2.parse({ fileIssues });
|
|
19672
19689
|
const result = await runImprovementReview2(input, { logger: logger22 });
|
|
19673
19690
|
logger22.info("Scheduled improvement_review complete", {
|
|
@@ -20310,6 +20327,7 @@ function initV2PipelineSubsystems(logger22, auditLogger) {
|
|
|
20310
20327
|
const pipelineEventBus = getPipelineEventBus();
|
|
20311
20328
|
const bridge = createEventBusBridge({ source: pipelineEventBus });
|
|
20312
20329
|
startTuneStage(pipelineEventBus, auditLogger !== void 0 ? { auditLogger } : void 0);
|
|
20330
|
+
configureUntrustedInputFirewall(auditLogger !== void 0 ? { auditLogger } : {});
|
|
20313
20331
|
startSwarmHealthSignals(getSwarmObserver(), pipelineEventBus);
|
|
20314
20332
|
startFailoverSignals({ pipelineBus: pipelineEventBus });
|
|
20315
20333
|
startImprovementReviewScheduler();
|
|
@@ -21752,7 +21770,7 @@ function adaptConfigToLibrary(config) {
|
|
|
21752
21770
|
}
|
|
21753
21771
|
function createBeliefPromoter() {
|
|
21754
21772
|
return async (event) => {
|
|
21755
|
-
const { getToolMemory } = await import("./tool-memory-
|
|
21773
|
+
const { getToolMemory } = await import("./tool-memory-AL3RAR67.js");
|
|
21756
21774
|
const tm = getToolMemory();
|
|
21757
21775
|
await tm.recordBelief(
|
|
21758
21776
|
`skill:${event.name}`,
|
|
@@ -22973,7 +22991,7 @@ async function handleResearchCommand(args) {
|
|
|
22973
22991
|
}
|
|
22974
22992
|
}
|
|
22975
22993
|
async function handleRegistryCommand(args) {
|
|
22976
|
-
const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-
|
|
22994
|
+
const { registryCommand, isValidRegistrySubcommand, formatRegistryUsage } = await import("./registry-command-YXFZ7LVE.js");
|
|
22977
22995
|
const subcommand = args.subcommand;
|
|
22978
22996
|
if (!isValidRegistrySubcommand(subcommand)) {
|
|
22979
22997
|
process.stdout.write(`${formatRegistryUsage()}
|
|
@@ -23021,12 +23039,12 @@ async function handleVerifyCommand(args) {
|
|
|
23021
23039
|
async function handleDoctorCommand(args) {
|
|
23022
23040
|
const exitCode = await doctorCommand({ fix: args.options.fix });
|
|
23023
23041
|
if (args.options.deep) {
|
|
23024
|
-
const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-
|
|
23042
|
+
const { runDeepDiagnostics: runDeepDiagnostics2, formatDeepDiagnostics: formatDeepDiagnostics2 } = await import("./doctor-deep-CPMR6TDF.js");
|
|
23025
23043
|
const diag = runDeepDiagnostics2();
|
|
23026
23044
|
process.stdout.write(formatDeepDiagnostics2(diag) + "\n");
|
|
23027
23045
|
}
|
|
23028
23046
|
if (args.options.live) {
|
|
23029
|
-
const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-
|
|
23047
|
+
const { runLiveReadiness, formatLiveReadiness } = await import("./doctor-live-GWE5IA7D.js");
|
|
23030
23048
|
const report = await runLiveReadiness();
|
|
23031
23049
|
process.stdout.write(formatLiveReadiness(report) + "\n");
|
|
23032
23050
|
if (report.some((r) => r.levels.serves.status === "failed")) {
|
|
@@ -23079,7 +23097,7 @@ async function runInitPortableFlow(args) {
|
|
|
23079
23097
|
return cliExit(result.success ? EXIT_CODES.SUCCESS : EXIT_CODES.SERVER_START_FAILED);
|
|
23080
23098
|
}
|
|
23081
23099
|
async function runInitOpencodeFlow(args) {
|
|
23082
|
-
const { runInitOpencode } = await import("./init-opencode-
|
|
23100
|
+
const { runInitOpencode } = await import("./init-opencode-7PKVI3LD.js");
|
|
23083
23101
|
const opencodePath = args.options.opencode;
|
|
23084
23102
|
if (opencodePath === void 0 || opencodePath === "") {
|
|
23085
23103
|
process.stderr.write("Error: --opencode requires a path argument.\n");
|
|
@@ -23105,7 +23123,7 @@ async function runInitOpencodeFlow(args) {
|
|
|
23105
23123
|
return cliExit(EXIT_CODES.SUCCESS);
|
|
23106
23124
|
}
|
|
23107
23125
|
async function renderOpencodeValidate(opencodePath) {
|
|
23108
|
-
const { runOpencodeValidate } = await import("./init-opencode-
|
|
23126
|
+
const { runOpencodeValidate } = await import("./init-opencode-7PKVI3LD.js");
|
|
23109
23127
|
const result = await runOpencodeValidate(opencodePath);
|
|
23110
23128
|
if (!result.ok) {
|
|
23111
23129
|
process.stderr.write(`init --opencode --validate: ${result.reason ?? "failed"}
|
|
@@ -23144,7 +23162,7 @@ async function handleSetupCommandAsync(args) {
|
|
|
23144
23162
|
return cliExitFromStatus(exitCode);
|
|
23145
23163
|
}
|
|
23146
23164
|
async function runCustomApiSetup(args) {
|
|
23147
|
-
const { configureCustomApi } = await import("./setup-custom-api-
|
|
23165
|
+
const { configureCustomApi } = await import("./setup-custom-api-2OXG6ERI.js");
|
|
23148
23166
|
const baseUrl = args.options.customApi;
|
|
23149
23167
|
if (baseUrl === void 0) return EXIT_CODES.SERVER_START_FAILED;
|
|
23150
23168
|
const input = {
|