nexus-agents 8.60.2 → 8.61.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.
Files changed (28) hide show
  1. package/dist/{chunk-Q3LSWYM5.js → chunk-3IDUHDPD.js} +9 -9
  2. package/dist/{chunk-5ZVGPKNO.js → chunk-AZI3WR3N.js} +101 -46
  3. package/dist/chunk-AZI3WR3N.js.map +1 -0
  4. package/dist/{chunk-3UAEJN4N.js → chunk-FV7WJ4ES.js} +2 -2
  5. package/dist/{chunk-RTEZ6OJY.js → chunk-K576C3OX.js} +3 -3
  6. package/dist/{chunk-7JA62DNM.js → chunk-PSCJ3ZSE.js} +2 -2
  7. package/dist/{chunk-TCEMOFIM.js → chunk-X3WILSBY.js} +3 -3
  8. package/dist/{chunk-426AIY5F.js → chunk-Z2WFGKLU.js} +2 -2
  9. package/dist/cli.js +57 -50
  10. package/dist/cli.js.map +1 -1
  11. package/dist/{consensus-vote-QMDRIAM7.js → consensus-vote-YKKVQIE7.js} +4 -4
  12. package/dist/{improvement-review-GFC6TLLK.js → improvement-review-CFUTXUKT.js} +4 -4
  13. package/dist/index.d.ts +8 -0
  14. package/dist/index.js +7 -7
  15. package/dist/{issue-triage-CGMODLMK.js → issue-triage-OMJMXLCX.js} +2 -2
  16. package/dist/{setup-data-dir-CVZAQ4R6.js → setup-data-dir-VMRENVQ6.js} +3 -3
  17. package/package.json +1 -1
  18. package/dist/chunk-5ZVGPKNO.js.map +0 -1
  19. /package/dist/{chunk-Q3LSWYM5.js.map → chunk-3IDUHDPD.js.map} +0 -0
  20. /package/dist/{chunk-3UAEJN4N.js.map → chunk-FV7WJ4ES.js.map} +0 -0
  21. /package/dist/{chunk-RTEZ6OJY.js.map → chunk-K576C3OX.js.map} +0 -0
  22. /package/dist/{chunk-7JA62DNM.js.map → chunk-PSCJ3ZSE.js.map} +0 -0
  23. /package/dist/{chunk-TCEMOFIM.js.map → chunk-X3WILSBY.js.map} +0 -0
  24. /package/dist/{chunk-426AIY5F.js.map → chunk-Z2WFGKLU.js.map} +0 -0
  25. /package/dist/{consensus-vote-QMDRIAM7.js.map → consensus-vote-YKKVQIE7.js.map} +0 -0
  26. /package/dist/{improvement-review-GFC6TLLK.js.map → improvement-review-CFUTXUKT.js.map} +0 -0
  27. /package/dist/{issue-triage-CGMODLMK.js.map → issue-triage-OMJMXLCX.js.map} +0 -0
  28. /package/dist/{setup-data-dir-CVZAQ4R6.js.map → setup-data-dir-VMRENVQ6.js.map} +0 -0
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  clampTaskTtl
24
- } from "./chunk-RTEZ6OJY.js";
24
+ } from "./chunk-K576C3OX.js";
25
25
  import {
26
26
  executeExpert
27
27
  } from "./chunk-QBVYOOEI.js";
@@ -71,7 +71,7 @@ import {
71
71
  updateStage,
72
72
  withWarnings,
73
73
  writeJobCancelled
74
- } from "./chunk-TCEMOFIM.js";
74
+ } from "./chunk-X3WILSBY.js";
75
75
  import {
76
76
  allOf,
77
77
  anyOf
@@ -87,14 +87,14 @@ import {
87
87
  createDurableAuditTrail,
88
88
  createGraphAuditBridge,
89
89
  emitPipelinePolicyEvent
90
- } from "./chunk-5ZVGPKNO.js";
90
+ } from "./chunk-AZI3WR3N.js";
91
91
  import {
92
92
  resolveEnvMode,
93
93
  sanitizeInput
94
94
  } from "./chunk-DIV6TBCN.js";
95
95
  import {
96
96
  withPrerequisite
97
- } from "./chunk-426AIY5F.js";
97
+ } from "./chunk-Z2WFGKLU.js";
98
98
  import {
99
99
  NOOP_NOTIFIER,
100
100
  RateLimiter,
@@ -117,7 +117,7 @@ import {
117
117
  toolSuccessStructured,
118
118
  withProgressHeartbeat,
119
119
  wrapToolWithTimeout
120
- } from "./chunk-3UAEJN4N.js";
120
+ } from "./chunk-FV7WJ4ES.js";
121
121
  import {
122
122
  EventTopics,
123
123
  UNRESOLVED_MODEL_ID,
@@ -45864,7 +45864,7 @@ async function tryIssueTriage(task) {
45864
45864
  try {
45865
45865
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
45866
45866
  if (issueMatch === null) return null;
45867
- const { createIssueTriage } = await import("./issue-triage-CGMODLMK.js");
45867
+ const { createIssueTriage } = await import("./issue-triage-OMJMXLCX.js");
45868
45868
  const triage = createIssueTriage();
45869
45869
  const owner = issueMatch[1] ?? "";
45870
45870
  const num2 = issueMatch[2] ?? "";
@@ -46266,7 +46266,7 @@ function buildVotingInput(plan, config) {
46266
46266
  }
46267
46267
  async function executeSingleVote(plan, config, log) {
46268
46268
  try {
46269
- const { executeVoting } = await import("./consensus-vote-QMDRIAM7.js");
46269
+ const { executeVoting } = await import("./consensus-vote-YKKVQIE7.js");
46270
46270
  const input = buildVotingInput(plan, config);
46271
46271
  const result = await executeVoting(input, log);
46272
46272
  return parseVotingResult(result);
@@ -48064,7 +48064,7 @@ ${contextBlock}`;
48064
48064
  const strategy = config.votingStrategy ?? "higher_order";
48065
48065
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
48066
48066
  try {
48067
- const { executeVoting } = await import("./consensus-vote-QMDRIAM7.js");
48067
+ const { executeVoting } = await import("./consensus-vote-YKKVQIE7.js");
48068
48068
  const votingResult = await executeVoting(
48069
48069
  {
48070
48070
  proposal: buildVoteProposal(plan, research),
@@ -57277,4 +57277,4 @@ export {
57277
57277
  startPipelineEventBridge,
57278
57278
  shutdownPipelineEventBridge
57279
57279
  };
57280
- //# sourceMappingURL=chunk-Q3LSWYM5.js.map
57280
+ //# sourceMappingURL=chunk-3IDUHDPD.js.map
@@ -1008,7 +1008,8 @@ function policyRefusal(policy, policyMode, user, effectiveTrustTier) {
1008
1008
  return {
1009
1009
  code: "POLICY_REFUSED",
1010
1010
  message: `Refused by firewall policy: ` + blocking.map((v) => `${v.rule} \u2014 ${v.message}`).join("; "),
1011
- stage: "policy"
1011
+ stage: "policy",
1012
+ violations: blocking
1012
1013
  };
1013
1014
  }
1014
1015
 
@@ -1569,29 +1570,82 @@ function getUntrustedInputFirewall() {
1569
1570
  return singleton;
1570
1571
  }
1571
1572
  function runUntrustedInputFirewall(input, options) {
1573
+ const result = processAndLog(input, options);
1574
+ if (!result.ok) return err(asError(result.error));
1575
+ return ok(result.value);
1576
+ }
1577
+ function evaluateActionThroughFirewall(input, options) {
1578
+ const { enforcedTier, ...processOptions } = options;
1579
+ const result = processAndLog(input, processOptions);
1580
+ if (!result.ok) {
1581
+ const { code, stage, violations } = result.error;
1582
+ if (code !== "POLICY_REFUSED" || stage !== "policy") return err(asError(result.error));
1583
+ if (violations === void 0 || violations.length === 0) return err(asError(result.error));
1584
+ return ok({ refused: true, allowed: false, violations, policyMode: "enforce" });
1585
+ }
1586
+ const { policy, policyMode, wouldRefuse, effectiveTrustTier } = result.value;
1587
+ if (policy?.scope !== "action") {
1588
+ const why = policy === void 0 ? "the policy stage is disabled" : `scope was ${policy.scope}`;
1589
+ return err(
1590
+ new Error(
1591
+ `Untrusted-input firewall did not evaluate policy for action ${options.action.type} (${why})`
1592
+ )
1593
+ );
1594
+ }
1595
+ if (effectiveTrustTier !== enforcedTier) {
1596
+ return err(
1597
+ new Error(
1598
+ `Untrusted-input firewall enforced tier ${effectiveTrustTier} for action ${options.action.type} but tier ${enforcedTier} for the classification`
1599
+ )
1600
+ );
1601
+ }
1602
+ return ok({
1603
+ refused: false,
1604
+ allowed: policy.allowed,
1605
+ requiresApproval: policy.requiresApproval,
1606
+ violations: policy.violations,
1607
+ effectiveTrustTier,
1608
+ policyMode,
1609
+ wouldRefuse
1610
+ });
1611
+ }
1612
+ function processAndLog(input, options) {
1572
1613
  const result = getUntrustedInputFirewall().process(input, options);
1573
1614
  if (!result.ok) {
1574
- const { code, stage, message } = result.error;
1575
1615
  logger4.warn("Untrusted-input firewall rejected the input", {
1576
1616
  user: input.username,
1577
1617
  sourceType: input.type,
1578
- code,
1579
- stage
1618
+ ...options.action !== void 0 ? { actionType: options.action.type } : {},
1619
+ code: result.error.code,
1620
+ stage: result.error.stage
1580
1621
  });
1581
- return err(new Error(`Untrusted-input firewall ${code} at stage ${stage}: ${message}`));
1622
+ return result;
1582
1623
  }
1583
1624
  if (result.value.wouldRefuse) {
1584
1625
  const policy = result.value.policy;
1585
1626
  logger4.warn("Untrusted-input firewall would refuse under enforce (audit mode)", {
1586
1627
  user: input.username,
1587
1628
  sourceType: input.type,
1629
+ ...options.action !== void 0 ? { actionType: options.action.type } : {},
1588
1630
  trustTier: result.value.effectiveTrustTier,
1589
1631
  scope: policy?.scope,
1590
1632
  rules: policy?.violations.filter((v) => v.severity === "block").map((v) => v.rule),
1591
1633
  unmeasured: policy?.unmeasured
1592
1634
  });
1593
1635
  }
1594
- return ok(result.value);
1636
+ return result;
1637
+ }
1638
+ function asError({ code, stage, message }) {
1639
+ return new Error(`Untrusted-input firewall ${code} at stage ${stage}: ${message}`);
1640
+ }
1641
+ function firewallInputFor(type, source) {
1642
+ return {
1643
+ type,
1644
+ username: source.author,
1645
+ authorAssociation: source.authorAssociation,
1646
+ title: source.title,
1647
+ body: source.body
1648
+ };
1595
1649
  }
1596
1650
 
1597
1651
  // src/scm/url-parsers.ts
@@ -1991,6 +2045,23 @@ function buildActionDetails(action, policy, corrob) {
1991
2045
  ...action.type === "ProposeLabels" && { labels: action.labels }
1992
2046
  };
1993
2047
  }
2048
+ function validateActionsThroughFirewall(input, gate, actions, existingLabels) {
2049
+ const labels = existingLabels !== void 0 ? { existingLabels } : {};
2050
+ const proposed = [];
2051
+ for (const action of actions) {
2052
+ const decision = evaluateActionThroughFirewall(input, { ...gate, ...labels, action });
2053
+ if (!decision.ok) return decision;
2054
+ const corrobResult = validateCorroboration(action);
2055
+ proposed.push({
2056
+ type: action.type,
2057
+ description: describeAction(action),
2058
+ policyApproved: decision.value.allowed,
2059
+ corroborated: corrobResult.satisfied,
2060
+ details: buildActionDetails(action, decision.value, corrobResult)
2061
+ });
2062
+ }
2063
+ return ok(proposed);
2064
+ }
1994
2065
 
1995
2066
  // src/dogfooding/issue-triage.ts
1996
2067
  var logger6 = createLogger({ component: "IssueTriage" });
@@ -2070,10 +2141,16 @@ var IssueTriage = class {
2070
2141
  const enforced = { ...trustResult, trustTier: gateDecision.enforcedTier };
2071
2142
  const actions = this.generateActions(safeTitle, safeBody, issueResult, enforced);
2072
2143
  const withEscalation = applySafetyActions(actions, gateDecision, reputation, issueResult);
2073
- const validatedActions = this.validateActions(withEscalation, gateDecision, existingLabels);
2144
+ const validatedActions = validateActionsThroughFirewall(
2145
+ firewallInputFor("issue", issueResult),
2146
+ { ...this.firewallOptions(reputation), enforcedTier: gateDecision.enforcedTier },
2147
+ withEscalation,
2148
+ existingLabels
2149
+ );
2150
+ if (!validatedActions.ok) return validatedActions;
2074
2151
  const result = this.buildResult({
2075
2152
  issue: issueResult,
2076
- actions: validatedActions,
2153
+ actions: validatedActions.value,
2077
2154
  trustResult,
2078
2155
  isAllowlisted: firewall.value.isAllowlisted,
2079
2156
  auditSink: firewall.value.auditSink,
@@ -2111,27 +2188,26 @@ var IssueTriage = class {
2111
2188
  * (#4992; originally Issue #828 — trust-classifier wiring).
2112
2189
  *
2113
2190
  * The access posture is passed per call so the firewall's Rule-of-Two check
2114
- * sees the same facts `validateActions` enforces on. No maintainer allowlist
2115
- * is passed: there is no source for one today (no config field, no env var),
2116
- * so none is consulted and `isAllowlisted` stays absent on the result rather
2117
- * than being recorded as `false`.
2191
+ * sees the same facts the per-action runs enforce on. No maintainer
2192
+ * allowlist is passed: there is no source for one today (no config field, no
2193
+ * env var), so none is consulted and `isAllowlisted` stays absent on the
2194
+ * result rather than being recorded as `false`.
2118
2195
  */
2119
2196
  classifyAuthor(issue, reputation) {
2120
2197
  return runUntrustedInputFirewall(
2121
- {
2122
- type: "issue",
2123
- username: issue.author,
2124
- authorAssociation: issue.authorAssociation,
2125
- title: issue.title,
2126
- body: issue.body
2127
- },
2128
- { context: this.accessContext(), reputation: { assessment: reputation } }
2198
+ firewallInputFor("issue", issue),
2199
+ this.firewallOptions(reputation)
2129
2200
  );
2130
2201
  }
2202
+ /** The per-call facts every firewall run of this triage shares (#4992, #5383). */
2203
+ firewallOptions(reputation) {
2204
+ return { context: this.accessContext(), reputation: { assessment: reputation } };
2205
+ }
2131
2206
  /**
2132
2207
  * The access posture this triage runs under — the two Rule-of-Two conjuncts
2133
- * that are about the agent rather than the input. Shared by the firewall
2134
- * (#4992) and `validateActions` so the two cannot disagree.
2208
+ * that are about the agent rather than the input. Passed to every firewall
2209
+ * run (#4992, #5383) so the classification and the per-action policy checks
2210
+ * cannot disagree on it.
2135
2211
  */
2136
2212
  accessContext() {
2137
2213
  return {
@@ -2202,29 +2278,6 @@ var IssueTriage = class {
2202
2278
  }
2203
2279
  return actions;
2204
2280
  }
2205
- /**
2206
- * Validates all actions through policy gate and corroboration validator.
2207
- * This completes the #828 wiring by integrating corroboration-validator.
2208
- * (Source: Issue #828 — policy-gate + corroboration-validator wiring)
2209
- */
2210
- validateActions(actions, gateDecision, existingLabels) {
2211
- const context = {
2212
- inputTrustTier: gateDecision.enforcedTier,
2213
- ...this.accessContext(),
2214
- ...existingLabels !== void 0 ? { existingLabels } : {}
2215
- };
2216
- return actions.map((action) => {
2217
- const policyDecision = evaluatePolicy(action, context);
2218
- const corrobResult = validateCorroboration(action);
2219
- return {
2220
- type: action.type,
2221
- description: describeAction(action),
2222
- policyApproved: policyDecision.allowed,
2223
- corroborated: corrobResult.satisfied,
2224
- details: buildActionDetails(action, policyDecision, corrobResult)
2225
- };
2226
- });
2227
- }
2228
2281
  /**
2229
2282
  * Builds the final triage result.
2230
2283
  */
@@ -2386,6 +2439,8 @@ export {
2386
2439
  createGitHubAdapter,
2387
2440
  configureUntrustedInputFirewall,
2388
2441
  runUntrustedInputFirewall,
2442
+ evaluateActionThroughFirewall,
2443
+ firewallInputFor,
2389
2444
  parsePRUrl,
2390
2445
  GitHubReviewer,
2391
2446
  GitHubUserInfo,
@@ -2393,4 +2448,4 @@ export {
2393
2448
  IssueTriage,
2394
2449
  createIssueTriage
2395
2450
  };
2396
- //# sourceMappingURL=chunk-5ZVGPKNO.js.map
2451
+ //# sourceMappingURL=chunk-AZI3WR3N.js.map