nexus-agents 2.81.1 → 2.81.3

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.
@@ -77,7 +77,7 @@ import {
77
77
  DEFAULT_TASK_TTL_MS,
78
78
  DEFAULT_TOOL_RATE_LIMITS,
79
79
  clampTaskTtl
80
- } from "./chunk-ZE7DKR6I.js";
80
+ } from "./chunk-WLAQXITV.js";
81
81
  import {
82
82
  getAvailabilityCache,
83
83
  resolveFallback
@@ -28246,15 +28246,12 @@ var PolicyEngine = class {
28246
28246
  return matched.sort((a, b) => b.priority - a.priority);
28247
28247
  }
28248
28248
  };
28249
- var DEFAULT_MAX_ATTEMPTS = 3;
28250
- var COST_WARNING_THRESHOLD = 0.8;
28251
28249
  var trustTierRule = {
28252
28250
  id: "trust-tier",
28253
28251
  priority: 100,
28254
28252
  evaluate(context) {
28255
- const state = context.pipelineState;
28256
- const tierVal = state["trustTier"];
28257
- const numericTier = typeof tierVal === "number" ? tierVal : typeof tierVal === "string" ? Number(tierVal) : Number.NaN;
28253
+ const tierVal = context.pipelineState.trustTier;
28254
+ const numericTier = tierVal === void 0 ? Number.NaN : Number(tierVal);
28258
28255
  const tier = Number.isFinite(numericTier) ? numericTier : void 0;
28259
28256
  if (tier !== void 0 && tier >= 3 && context.stageType === "execute") {
28260
28257
  return {
@@ -28266,83 +28263,7 @@ var trustTierRule = {
28266
28263
  return { allow: true };
28267
28264
  }
28268
28265
  };
28269
- var securityReviewRule = {
28270
- id: "security-review",
28271
- priority: 90,
28272
- evaluate(context) {
28273
- const state = context.pipelineState;
28274
- const needsReview = state["securityReviewRequired"] === true;
28275
- const hasReview = state["securityReviewComplete"] === true;
28276
- if (needsReview && !hasReview && context.stageType === "execute") {
28277
- return {
28278
- allow: false,
28279
- reason: "Security review required before implementation"
28280
- };
28281
- }
28282
- return { allow: true };
28283
- }
28284
- };
28285
- var boundedIterationRule = {
28286
- id: "bounded-iteration",
28287
- priority: 80,
28288
- evaluate(context) {
28289
- const state = context.pipelineState;
28290
- const attemptsVal = state["stageAttempts"];
28291
- const attempts = typeof attemptsVal === "number" ? attemptsVal : void 0;
28292
- if (attempts !== void 0 && attempts >= DEFAULT_MAX_ATTEMPTS) {
28293
- return {
28294
- allow: false,
28295
- reason: `Stage "${context.stageId}" exceeded max retries`
28296
- };
28297
- }
28298
- return { allow: true };
28299
- }
28300
- };
28301
- var costBudgetRule = {
28302
- id: "cost-budget",
28303
- priority: 70,
28304
- evaluate(context) {
28305
- const state = context.pipelineState;
28306
- const spentVal = state["costAccumulator"];
28307
- const spent = typeof spentVal === "number" ? spentVal : void 0;
28308
- const budgetVal = state["costBudget"];
28309
- const budget = typeof budgetVal === "number" ? budgetVal : void 0;
28310
- if (spent !== void 0 && budget !== void 0) {
28311
- if (spent > budget * COST_WARNING_THRESHOLD) {
28312
- return {
28313
- allow: false,
28314
- reason: "Approaching cost budget limit",
28315
- escalateTo: "user"
28316
- };
28317
- }
28318
- }
28319
- return { allow: true };
28320
- }
28321
- };
28322
- var highRiskApprovalRule = {
28323
- id: "high-risk-approval",
28324
- priority: 60,
28325
- evaluate(context) {
28326
- const state = context.pipelineState;
28327
- const isHighRisk = state["highRisk"] === true;
28328
- const approved = state["userApproved"] === true;
28329
- if (isHighRisk && !approved) {
28330
- return {
28331
- allow: false,
28332
- reason: "High-risk action requires user approval",
28333
- escalateTo: "user"
28334
- };
28335
- }
28336
- return { allow: true };
28337
- }
28338
- };
28339
- var BUILT_IN_RULES = [
28340
- trustTierRule,
28341
- securityReviewRule,
28342
- boundedIterationRule,
28343
- costBudgetRule,
28344
- highRiskApprovalRule
28345
- ];
28266
+ var BUILT_IN_RULES = [trustTierRule];
28346
28267
  function createDefaultPolicyEngine() {
28347
28268
  const engine = new PolicyEngine();
28348
28269
  for (const rule of BUILT_IN_RULES) {
@@ -28482,6 +28403,10 @@ function buildBaseTaskContract(input) {
28482
28403
  }
28483
28404
 
28484
28405
  // src/pipeline/v2-delegate.ts
28406
+ function toPipelineStateSnapshot(metadata) {
28407
+ const trustTier = metadata["trustTier"];
28408
+ return typeof trustTier === "string" ? { trustTier } : {};
28409
+ }
28485
28410
  var logger22 = createLogger({ component: "V2Delegate" });
28486
28411
  function createDelegatePipeline(task) {
28487
28412
  const plan = buildPlan(task);
@@ -28541,7 +28466,10 @@ function checkPipelinePolicy(task, stageType) {
28541
28466
  taskId: task.id,
28542
28467
  stageId: `pre-execution-${stageType}`,
28543
28468
  stageType,
28544
- pipelineState: task.metadata
28469
+ // #2932: typed extraction. The untyped `task.metadata` is the producer
28470
+ // surface — we narrow to the policy snapshot here so adding a new rule
28471
+ // forces an explicit producer wire-up at this single chokepoint.
28472
+ pipelineState: toPipelineStateSnapshot(task.metadata)
28545
28473
  };
28546
28474
  const result = evaluatePolicy2({ engine, mode }, context);
28547
28475
  if (!result.allowed) {
@@ -36374,6 +36302,36 @@ function createRegistryError(code, message, paperId, cause) {
36374
36302
  }
36375
36303
  return error;
36376
36304
  }
36305
+ function paperEntryToResearchPaper(entry) {
36306
+ return {
36307
+ title: entry.title,
36308
+ authors: [...entry.authors],
36309
+ source: entry.source,
36310
+ arxiv_id: entry.arxiv_id,
36311
+ url: entry.url,
36312
+ publication_date: entry.publication_date,
36313
+ venue: entry.venue,
36314
+ topics: [...entry.topics],
36315
+ tags: [...entry.tags],
36316
+ reviewed_date: entry.reviewed_date,
36317
+ reviewed_in: entry.reviewed_in,
36318
+ summary: entry.summary,
36319
+ key_findings: [...entry.key_findings],
36320
+ relevance: entry.relevance,
36321
+ techniques_extracted: [...entry.techniques_extracted],
36322
+ related_issues: [...entry.related_issues],
36323
+ implementation_status: entry.implementation_status,
36324
+ rigor_tags: entry.rigor_tags ? [...entry.rigor_tags] : [],
36325
+ ...entry.venue_tier !== void 0 ? { venue_tier: entry.venue_tier } : {},
36326
+ ...entry.quality_score !== void 0 ? { quality_score: entry.quality_score } : {},
36327
+ ...entry.evidence_tier !== void 0 ? { evidence_tier: entry.evidence_tier } : {},
36328
+ ...entry.citation_count !== void 0 ? { citation_count: entry.citation_count } : {},
36329
+ ...entry.has_code !== void 0 ? { has_code: entry.has_code } : {},
36330
+ ...entry.code_url !== void 0 ? { code_url: entry.code_url } : {},
36331
+ ...entry.quality_notes !== void 0 ? { quality_notes: entry.quality_notes } : {},
36332
+ ...entry.last_quality_check !== void 0 ? { last_quality_check: entry.last_quality_check } : {}
36333
+ };
36334
+ }
36377
36335
  function generateRegistryEntry(metadata, topic) {
36378
36336
  if (metadata.id === "" || metadata.title === "") {
36379
36337
  return {
@@ -36409,7 +36367,7 @@ function generateRegistryEntry(metadata, topic) {
36409
36367
  related_issues: [],
36410
36368
  implementation_status: "not-started"
36411
36369
  };
36412
- const paperForScoring = entry;
36370
+ const paperForScoring = paperEntryToResearchPaper(entry);
36413
36371
  const qualityScore = computeQualityScore(paperForScoring);
36414
36372
  const evidenceTier = computeEvidenceTier({ ...paperForScoring, quality_score: qualityScore });
36415
36373
  const scoredEntry = {
@@ -50271,4 +50229,4 @@ export {
50271
50229
  detectBackend,
50272
50230
  createTaskTracker
50273
50231
  };
50274
- //# sourceMappingURL=chunk-VTSGQFEZ.js.map
50232
+ //# sourceMappingURL=chunk-755EZIUF.js.map