nexus-agents 2.92.3 → 2.92.4

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/index.js CHANGED
@@ -27,7 +27,6 @@ import {
27
27
  AuditQueryCriteriaSchema,
28
28
  AuditResourceSchema,
29
29
  AuditSeveritySchema,
30
- AuditTrail,
31
30
  AuthorizationMethodSchema,
32
31
  BUILT_IN_RULES,
33
32
  BUILT_IN_TEMPLATES,
@@ -139,7 +138,6 @@ import {
139
138
  LoadedSkillSetSchema,
140
139
  MAX_DIFF_LENGTH,
141
140
  MAX_EXECUTION_TIME_MS,
142
- MAX_STRIPPED_ELEMENTS_PER_EVENT,
143
141
  MIN_EXPERTS_FOR_PATTERN,
144
142
  MODEL_CAPABILITIES,
145
143
  MemoryQueryInputSchema,
@@ -308,7 +306,6 @@ import {
308
306
  createArchitectureExpert,
309
307
  createAttestation,
310
308
  createAuditLogger,
311
- createAuditTrail,
312
309
  createCheckpoint,
313
310
  createCheckpointStore,
314
311
  createCodeExpert,
@@ -330,7 +327,6 @@ import {
330
327
  createExecutionPlan,
331
328
  createFeedbackIntegration,
332
329
  createFeedbackSubscriber,
333
- createGraphAuditBridge,
334
330
  createInitializedWorkflowEngine,
335
331
  createInteractionGraph,
336
332
  createIsolatedRegistry,
@@ -372,21 +368,15 @@ import {
372
368
  customReducer,
373
369
  decomposeSpec,
374
370
  delegateInputToTaskContract,
375
- emitCorroborationEvent,
376
371
  emitExecutionComplete,
377
- emitGraphExecutionEvent,
378
372
  emitNodeResults,
379
373
  emitNodeStarted,
380
374
  emitPipelineStageEvent,
381
- emitPolicyEvent,
382
- emitReputationEvent,
383
- emitSanitizationEvent,
384
375
  emitStageCompleted,
385
376
  emitStageFailed,
386
377
  emitStageStarted,
387
378
  emitStateUpdated,
388
379
  emitStepCompleted,
389
- emitTrustEvent,
390
380
  estimateTokens,
391
381
  evaluatePolicy as evaluatePolicy2,
392
382
  executeDelegatePipeline,
@@ -519,7 +509,7 @@ import {
519
509
  validateWorkflow,
520
510
  validateWorkflowDependencies,
521
511
  withLogging
522
- } from "./chunk-7UPXKDF2.js";
512
+ } from "./chunk-4LEUIAYB.js";
523
513
  import {
524
514
  getTokenEnvVars,
525
515
  hasToken,
@@ -632,7 +622,7 @@ import {
632
622
  validateToolInput,
633
623
  withModelNotFoundFallback,
634
624
  wrapResilientWithFallback
635
- } from "./chunk-UYOHV3EG.js";
625
+ } from "./chunk-JCYCITBK.js";
636
626
  import {
637
627
  AdapterModelError,
638
628
  BaseAdapter,
@@ -663,14 +653,25 @@ import {
663
653
  import "./chunk-CGSVTROC.js";
664
654
  import {
665
655
  AgentActionSchema,
656
+ AuditTrail,
666
657
  GitHubReviewer,
667
658
  GitHubUserInfo,
659
+ MAX_STRIPPED_ELEMENTS_PER_EVENT,
668
660
  SourceCitationSchema,
669
661
  ViolationSchema,
670
662
  canInfluenceDecisions,
671
663
  canProceed,
664
+ checkRuleOfTwo,
672
665
  classifyTrust,
666
+ createAuditTrail,
673
667
  createFullGitHubProvider,
668
+ createGraphAuditBridge,
669
+ emitCorroborationEvent,
670
+ emitGraphExecutionEvent,
671
+ emitPolicyEvent,
672
+ emitReputationEvent,
673
+ emitSanitizationEvent,
674
+ emitTrustEvent,
674
675
  evaluatePolicy as evaluatePolicy3,
675
676
  getCorroborationRules,
676
677
  getRequiredTrustTier,
@@ -681,7 +682,7 @@ import {
681
682
  requiresCorroboration,
682
683
  validateAgentAction,
683
684
  validateCorroboration
684
- } from "./chunk-C6PEYEPU.js";
685
+ } from "./chunk-IHPYT6WU.js";
685
686
  import {
686
687
  GitHubProvider,
687
688
  ScmError
@@ -740,7 +741,7 @@ import {
740
741
  getKnownNexusVarNames,
741
742
  startStdioServer,
742
743
  validateNexusEnv
743
- } from "./chunk-BFYOPX2E.js";
744
+ } from "./chunk-MZFWRU6E.js";
744
745
  import {
745
746
  AvailabilityCache,
746
747
  filterAvailableModels,
@@ -4152,6 +4153,7 @@ function decodeATLValue(value) {
4152
4153
  }
4153
4154
 
4154
4155
  // src/security/firewall/firewall-pipeline.ts
4156
+ var logger4 = createLogger({ component: "HostileInputFirewall" });
4155
4157
  var HostileInputFirewall = class {
4156
4158
  stages;
4157
4159
  allowlisted;
@@ -4159,6 +4161,7 @@ var HostileInputFirewall = class {
4159
4161
  adapter;
4160
4162
  reputationCache;
4161
4163
  auditTrail;
4164
+ context;
4162
4165
  constructor(config) {
4163
4166
  const validated = FirewallConfigSchema.parse({
4164
4167
  stages: config.stages,
@@ -4172,6 +4175,7 @@ var HostileInputFirewall = class {
4172
4175
  this.adapter = config.adapter;
4173
4176
  this.reputationCache = new ReputationCache();
4174
4177
  this.auditTrail = createAuditTrail();
4178
+ this.context = validated.context;
4175
4179
  }
4176
4180
  /**
4177
4181
  * Processes untrusted input through the firewall pipeline.
@@ -4188,6 +4192,18 @@ var HostileInputFirewall = class {
4188
4192
  const reputation = this.runReputation(meta, sanitized);
4189
4193
  const effectiveTrustTier = reconcileTrustTier(trust.trustTier, reputation);
4190
4194
  const atl = this.buildATL(meta, effectiveTrustTier, sanitized, reputation);
4195
+ const ruleOfTwoViolation = this.stages.policyEnforcement ? checkRuleOfTwo({
4196
+ inputTrustTier: effectiveTrustTier,
4197
+ hasWriteAccess: this.context.hasWriteAccess,
4198
+ hasSecretAccess: this.context.hasSecretAccess
4199
+ }) : void 0;
4200
+ if (ruleOfTwoViolation !== void 0) {
4201
+ logger4.warn("Firewall surfaced a Rule-of-Two violation", {
4202
+ user: meta.username,
4203
+ effectiveTrustTier,
4204
+ rule: ruleOfTwoViolation.rule
4205
+ });
4206
+ }
4191
4207
  const auditEvents = this.auditTrail.query().map((e) => ({ id: e.id, type: e.type }));
4192
4208
  return ok({
4193
4209
  sanitized,
@@ -4195,6 +4211,7 @@ var HostileInputFirewall = class {
4195
4211
  ...reputation !== void 0 ? { reputation } : {},
4196
4212
  effectiveTrustTier,
4197
4213
  atl,
4214
+ ...ruleOfTwoViolation !== void 0 ? { ruleOfTwoViolation } : {},
4198
4215
  auditEvents,
4199
4216
  durationMs: Date.now() - start
4200
4217
  });
@@ -4797,7 +4814,7 @@ var DEFAULT_BENCHMARK_CONFIG = {
4797
4814
 
4798
4815
  // src/benchmarks/benchmark-runner.ts
4799
4816
  import { cpus, totalmem, platform, arch } from "os";
4800
- var logger4 = createLogger({ component: "benchmark-runner" });
4817
+ var logger5 = createLogger({ component: "benchmark-runner" });
4801
4818
  var LatencySampler = class {
4802
4819
  samples = [];
4803
4820
  startTimes = /* @__PURE__ */ new Map();
@@ -4893,11 +4910,11 @@ async function runOperationBenchmark(operation, datasetSize, fn, config = {}) {
4893
4910
  const startTime = getTimeProvider().now();
4894
4911
  const startMemory = process.memoryUsage().heapUsed;
4895
4912
  let peakMemory = startMemory;
4896
- logger4.debug("Running warmup", { operation, iterations: cfg.warmupIterations });
4913
+ logger5.debug("Running warmup", { operation, iterations: cfg.warmupIterations });
4897
4914
  for (let i = 0; i < cfg.warmupIterations; i++) {
4898
4915
  await fn();
4899
4916
  }
4900
- logger4.debug("Running measurements", { operation, iterations: cfg.measurementIterations });
4917
+ logger5.debug("Running measurements", { operation, iterations: cfg.measurementIterations });
4901
4918
  for (let i = 0; i < cfg.measurementIterations; i++) {
4902
4919
  const id = `op-${String(i)}`;
4903
4920
  sampler.start(id);
@@ -5022,7 +5039,7 @@ ${"=".repeat(60)}`);
5022
5039
  }
5023
5040
 
5024
5041
  // src/benchmarks/memory-benchmarks.ts
5025
- var logger5 = createLogger({ component: "memory-benchmarks" });
5042
+ var logger6 = createLogger({ component: "memory-benchmarks" });
5026
5043
  var DEFAULT_MEMORY_BENCHMARK_CONFIG = {
5027
5044
  ...DEFAULT_BENCHMARK_CONFIG,
5028
5045
  contentSizeBytes: 1024,
@@ -5130,9 +5147,9 @@ async function benchmarkPrune(backend, data, config) {
5130
5147
  async function runMemoryBenchmarks(backend, name, config = {}) {
5131
5148
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
5132
5149
  const operations = [];
5133
- logger5.info("Starting memory benchmarks", { name, sizes: cfg.datasetSizes });
5150
+ logger6.info("Starting memory benchmarks", { name, sizes: cfg.datasetSizes });
5134
5151
  for (const size of cfg.datasetSizes) {
5135
- logger5.info("Running benchmarks for dataset size", { size });
5152
+ logger6.info("Running benchmarks for dataset size", { size });
5136
5153
  const data = generateTestData(size, cfg);
5137
5154
  try {
5138
5155
  const futureDate = new Date(getTimeProvider().now() + 365 * 24 * 60 * 60 * 1e3);
@@ -5146,7 +5163,7 @@ async function runMemoryBenchmarks(backend, name, config = {}) {
5146
5163
  }
5147
5164
  const environment = getBenchmarkEnvironment();
5148
5165
  const summary = createBenchmarkSummary(operations, cfg);
5149
- logger5.info("Benchmarks complete", {
5166
+ logger6.info("Benchmarks complete", {
5150
5167
  name,
5151
5168
  passed: summary.passed,
5152
5169
  avgP95: summary.avgP95Latency,
@@ -5192,7 +5209,7 @@ function compareBenchmarks(baseline, current) {
5192
5209
  }
5193
5210
 
5194
5211
  // src/benchmarks/token-benchmark.ts
5195
- var logger6 = createLogger({ component: "token-benchmark" });
5212
+ var logger7 = createLogger({ component: "token-benchmark" });
5196
5213
  var CHARS_PER_TOKEN2 = 4;
5197
5214
  function estimateTokens2(text) {
5198
5215
  return Math.ceil(text.length / CHARS_PER_TOKEN2);
@@ -5210,7 +5227,7 @@ async function runTokenBenchmark(backend, config = {}) {
5210
5227
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
5211
5228
  const results = [];
5212
5229
  for (const size of cfg.datasetSizes) {
5213
- logger6.info("Running token benchmark", { size });
5230
+ logger7.info("Running token benchmark", { size });
5214
5231
  const data = generateTestData(size, cfg);
5215
5232
  for (const entry of data.entries) {
5216
5233
  await backend.store(entry.key, entry.content, {
@@ -5243,15 +5260,15 @@ async function runTokenBenchmark(backend, config = {}) {
5243
5260
  }
5244
5261
 
5245
5262
  // src/benchmarks/consolidation-benchmark.ts
5246
- var logger7 = createLogger({ component: "consolidation-benchmark" });
5263
+ var logger8 = createLogger({ component: "consolidation-benchmark" });
5247
5264
  async function runConsolidationBenchmark(operations, config = {}) {
5248
5265
  const cfg = { ...DEFAULT_MEMORY_BENCHMARK_CONFIG, ...config };
5249
5266
  const benchmarks = [];
5250
- logger7.info("Starting consolidation benchmarks", {
5267
+ logger8.info("Starting consolidation benchmarks", {
5251
5268
  operationCount: operations.length
5252
5269
  });
5253
5270
  for (const op of operations) {
5254
- logger7.info("Benchmarking consolidation operation", { name: op.name });
5271
+ logger8.info("Benchmarking consolidation operation", { name: op.name });
5255
5272
  const benchmark = await runOperationBenchmark(
5256
5273
  op.name,
5257
5274
  0,
@@ -5366,7 +5383,7 @@ function formatBenchmarkReport(report) {
5366
5383
  }
5367
5384
 
5368
5385
  // src/benchmarks/adapter-latency-benchmark.ts
5369
- var logger8 = createLogger({ component: "adapter-latency-benchmark" });
5386
+ var logger9 = createLogger({ component: "adapter-latency-benchmark" });
5370
5387
  var DEFAULT_ADAPTER_LATENCY_CONFIG = {
5371
5388
  warmupIterations: 3,
5372
5389
  measurementIterations: 10,
@@ -5416,7 +5433,7 @@ async function benchmarkScenario(adapter, scenario, config) {
5416
5433
  const errors = [];
5417
5434
  let successCount = 0;
5418
5435
  let failureCount = 0;
5419
- logger8.info("Benchmarking scenario", {
5436
+ logger9.info("Benchmarking scenario", {
5420
5437
  adapter: adapter.name,
5421
5438
  scenario: scenario.name,
5422
5439
  warmup: config.warmupIterations,
@@ -5837,10 +5854,10 @@ var GateCheckResultSchema = z16.object({
5837
5854
  });
5838
5855
 
5839
5856
  // src/pipeline/quality-pipeline.ts
5840
- var logger9 = createLogger({ component: "quality-pipeline" });
5857
+ var logger10 = createLogger({ component: "quality-pipeline" });
5841
5858
 
5842
5859
  // src/pipeline/research-trigger.ts
5843
- var logger10 = createLogger({ component: "research-trigger" });
5860
+ var logger11 = createLogger({ component: "research-trigger" });
5844
5861
  var DEFAULT_QUALITY_THRESHOLD = 7;
5845
5862
  var DEFAULT_MAX_TRIGGERS = 3;
5846
5863
  function parseDiscoveries(text) {
@@ -5872,7 +5889,7 @@ async function checkForResearchTriggers(config = {}) {
5872
5889
  `Use research_discover to find recent papers and repos about "${topic}". For each result, include: title, quality score (1-10), and source URL.`
5873
5890
  );
5874
5891
  if (!result.success) {
5875
- logger10.debug("Research trigger: expert unavailable", { error: result.error });
5892
+ logger11.debug("Research trigger: expert unavailable", { error: result.error });
5876
5893
  return [];
5877
5894
  }
5878
5895
  const discoveries = parseDiscoveries(result.text);
@@ -5888,7 +5905,7 @@ Assess this research for applicability to nexus-agents.`,
5888
5905
  status: "pending"
5889
5906
  }));
5890
5907
  if (tasks.length > 0) {
5891
- logger10.info("Research triggers created", {
5908
+ logger11.info("Research triggers created", {
5892
5909
  total: discoveries.length,
5893
5910
  qualified: qualified.length,
5894
5911
  triggered: tasks.length
@@ -5896,13 +5913,13 @@ Assess this research for applicability to nexus-agents.`,
5896
5913
  }
5897
5914
  return tasks;
5898
5915
  } catch (error) {
5899
- logger10.debug("Research trigger failed gracefully", { error: String(error) });
5916
+ logger11.debug("Research trigger failed gracefully", { error: String(error) });
5900
5917
  return [];
5901
5918
  }
5902
5919
  }
5903
5920
 
5904
5921
  // src/pipeline/research-pipeline.ts
5905
- var logger11 = createLogger({ component: "research-pipeline" });
5922
+ var logger12 = createLogger({ component: "research-pipeline" });
5906
5923
 
5907
5924
  // src/pipeline/iterative-consensus.ts
5908
5925
  var defaultLogger = createLogger({ component: "iterative-consensus" });
@@ -5971,7 +5988,7 @@ function buildVotingInput(plan, config) {
5971
5988
  }
5972
5989
  async function executeSingleVote(plan, config, log) {
5973
5990
  try {
5974
- const { executeVoting } = await import("./consensus-vote-VSRNSZ5J.js");
5991
+ const { executeVoting } = await import("./consensus-vote-4RIUUEZQ.js");
5975
5992
  const input = buildVotingInput(plan, config);
5976
5993
  const result = await executeVoting(input, log);
5977
5994
  return parseVotingResult(result);
@@ -6056,7 +6073,7 @@ function formatContent(content) {
6056
6073
  }
6057
6074
 
6058
6075
  // src/replay/replay-executor.ts
6059
- var logger12 = createLogger({ component: "ReplayExecutor" });
6076
+ var logger13 = createLogger({ component: "ReplayExecutor" });
6060
6077
  export {
6061
6078
  ALLOWED_COMMANDS,
6062
6079
  ARTIFACT_TYPES,