nexus-agents 2.50.0 → 2.52.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.
@@ -5,6 +5,7 @@ import {
5
5
  import {
6
6
  ClaudeAdapter,
7
7
  DEFAULT_RELEVANCE_CONFIG,
8
+ EventTopics,
8
9
  NOOP_NOTIFIER,
9
10
  RateLimiter,
10
11
  createDefaultRateLimiter,
@@ -26,7 +27,7 @@ import {
26
27
  withAccessPolicy,
27
28
  withProgressHeartbeat,
28
29
  wrapToolWithTimeout
29
- } from "./chunk-KC3NUWZT.js";
30
+ } from "./chunk-CYTWXE7N.js";
30
31
  import {
31
32
  REGISTRY_PATH,
32
33
  getProjectRoot,
@@ -40,7 +41,7 @@ import {
40
41
  import {
41
42
  IssueTriage,
42
43
  sanitizeInput
43
- } from "./chunk-E24JT23A.js";
44
+ } from "./chunk-O6GZH7GZ.js";
44
45
  import {
45
46
  generateSecurityPlan
46
47
  } from "./chunk-YRPOXUXI.js";
@@ -66,7 +67,7 @@ import {
66
67
  import {
67
68
  DEFAULT_TASK_TTL_MS,
68
69
  clampTaskTtl
69
- } from "./chunk-NAN7IILE.js";
70
+ } from "./chunk-QGM2CANY.js";
70
71
  import {
71
72
  createSessionMemory
72
73
  } from "./chunk-ULDKSIS7.js";
@@ -871,7 +872,7 @@ var AvailabilityCache = class {
871
872
  get(modelId) {
872
873
  const entry = this.cache.get(modelId);
873
874
  if (entry === void 0) return void 0;
874
- if (Date.now() - entry.checkedAt > this.ttlMs) {
875
+ if (getTimeProvider().now() - entry.checkedAt > this.ttlMs) {
875
876
  this.cache.delete(modelId);
876
877
  return void 0;
877
878
  }
@@ -893,7 +894,7 @@ var AvailabilityCache = class {
893
894
  modelId,
894
895
  available: false,
895
896
  latencyMs: 0,
896
- checkedAt: Date.now(),
897
+ checkedAt: getTimeProvider().now(),
897
898
  error
898
899
  });
899
900
  }
@@ -903,7 +904,7 @@ var AvailabilityCache = class {
903
904
  modelId,
904
905
  available: true,
905
906
  latencyMs,
906
- checkedAt: Date.now()
907
+ checkedAt: getTimeProvider().now()
907
908
  });
908
909
  }
909
910
  /** Check if a model is known-unavailable (cached and not expired). */
@@ -14335,57 +14336,6 @@ var logger4 = createLogger({ component: "self-debug-protocol" });
14335
14336
  // src/agents/collaboration/ast-fixer.ts
14336
14337
  import { Project, SyntaxKind, Node } from "ts-morph";
14337
14338
 
14338
- // src/agents/collaboration/event-bus-topics.ts
14339
- var EventTopics = {
14340
- // Session events
14341
- SESSION_CREATED: "session.created",
14342
- SESSION_STATUS_CHANGED: "session.status_changed",
14343
- SESSION_PARTICIPANT_JOINED: "session.participant_joined",
14344
- SESSION_RESULT_SUBMITTED: "session.result_submitted",
14345
- SESSION_FINALIZED: "session.finalized",
14346
- SESSION_ALL: "session.*",
14347
- // Message events
14348
- MESSAGE_SENT: "message.sent",
14349
- MESSAGE_RECEIVED: "message.received",
14350
- MESSAGE_ALL: "message.*",
14351
- // Agent events
14352
- AGENT_TASK_DELEGATED: "agent.task_delegated",
14353
- AGENT_RESULT_BROADCAST: "agent.result_broadcast",
14354
- AGENT_ALL: "agent.*",
14355
- // Consensus events
14356
- CONSENSUS_VOTE_REQUESTED: "consensus.vote_requested",
14357
- CONSENSUS_VOTE_CAST: "consensus.vote_cast",
14358
- CONSENSUS_REACHED: "consensus.reached",
14359
- CONSENSUS_ALL: "consensus.*",
14360
- // Protocol events
14361
- PROTOCOL_STARTED: "protocol.started",
14362
- PROTOCOL_ITERATION: "protocol.iteration",
14363
- PROTOCOL_COMPLETED: "protocol.completed",
14364
- PROTOCOL_ALL: "protocol.*",
14365
- // Aegean phase events (Issue #216)
14366
- AEGEAN_ROUND_STARTED: "protocol.aegean.round_started",
14367
- AEGEAN_VOTE_COLLECTED: "protocol.aegean.vote_collected",
14368
- AEGEAN_QUORUM_DETECTED: "protocol.aegean.quorum_detected",
14369
- AEGEAN_ALL: "protocol.aegean.*",
14370
- // Reflexion phase events (Issue #216)
14371
- REFLEXION_CRITIQUE_STARTED: "protocol.reflexion.critique_started",
14372
- REFLEXION_CRITIQUE_COMPLETED: "protocol.reflexion.critique_completed",
14373
- REFLEXION_SYNTHESIS: "protocol.reflexion.synthesis",
14374
- REFLEXION_ALL: "protocol.reflexion.*",
14375
- // Trinity phase events (Issue #216)
14376
- TRINITY_PHASE_STARTED: "protocol.trinity.phase_started",
14377
- TRINITY_PHASE_COMPLETED: "protocol.trinity.phase_completed",
14378
- TRINITY_ALL: "protocol.trinity.*",
14379
- // Byzantine detection events (Issue #218)
14380
- BYZANTINE_WEIGHT_UPDATED: "byzantine.weight_updated",
14381
- BYZANTINE_PATTERN_DETECTED: "byzantine.pattern_detected",
14382
- BYZANTINE_AGENT_FLAGGED: "byzantine.agent_flagged",
14383
- BYZANTINE_COLLUSION_SUSPECTED: "byzantine.collusion_suspected",
14384
- BYZANTINE_ALL: "byzantine.*",
14385
- // Wildcard
14386
- ALL: "*"
14387
- };
14388
-
14389
14339
  // src/agents/collaboration/agent-message-router-types.ts
14390
14340
  var DEFAULT_ROUTER_CONFIG = {
14391
14341
  timeoutMs: AGENT_ROUTER_TIMEOUTS.defaultMs,
@@ -27315,7 +27265,7 @@ function recordExpertOutcome(role, success, durationMs, error) {
27315
27265
  const store = getOutcomeStore();
27316
27266
  const errorMsg = error ?? "expert creation failed";
27317
27267
  store.append({
27318
- id: `expert-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
27268
+ id: `expert-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
27319
27269
  cli: DEFAULT_CLI,
27320
27270
  category: resolveCategory(role),
27321
27271
  model: "expert",
@@ -33252,7 +33202,7 @@ function recordWorkerOutcomes(results, taskDescription) {
33252
33202
  const success = r.status === "success";
33253
33203
  const cli = r.resolvedCli ?? fallbackCli;
33254
33204
  store.append({
33255
- id: `worker-${r.role}-${String(Date.now())}-${Math.random().toString(36).slice(2, 6)}`,
33205
+ id: `worker-${r.role}-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 6)}`,
33256
33206
  cli,
33257
33207
  category,
33258
33208
  model: `worker-${r.role}`,
@@ -33339,7 +33289,7 @@ var ReflectionCache = class {
33339
33289
  const key = this.normalize(query);
33340
33290
  const entry = this.entries.get(key);
33341
33291
  if (entry === void 0) return void 0;
33342
- if (Date.now() - entry.timestamp > this.ttlMs) {
33292
+ if (getTimeProvider().now() - entry.timestamp > this.ttlMs) {
33343
33293
  this.entries.delete(key);
33344
33294
  return void 0;
33345
33295
  }
@@ -33354,7 +33304,7 @@ var ReflectionCache = class {
33354
33304
  const oldest = this.entries.keys().next();
33355
33305
  if (oldest.done !== true) this.entries.delete(oldest.value);
33356
33306
  }
33357
- this.entries.set(key, { criteria, timestamp: Date.now() });
33307
+ this.entries.set(key, { criteria, timestamp: getTimeProvider().now() });
33358
33308
  }
33359
33309
  get size() {
33360
33310
  return this.entries.size;
@@ -33670,11 +33620,12 @@ var TaskAccessPolicySchema = z64.object({
33670
33620
  });
33671
33621
 
33672
33622
  // src/security/access-constraint-deriver/config.ts
33623
+ var DEFAULT_ACCESS_POLICY_MODE = "audit";
33673
33624
  function resolveAccessPolicyMode(env = process.env) {
33674
33625
  const raw = env["NEXUS_ACCESS_POLICY_MODE"];
33675
- if (typeof raw !== "string" || raw.length === 0) return "off";
33626
+ if (typeof raw !== "string" || raw.length === 0) return DEFAULT_ACCESS_POLICY_MODE;
33676
33627
  const parsed = AccessPolicyModeSchema.safeParse(raw.toLowerCase());
33677
- return parsed.success ? parsed.data : "off";
33628
+ return parsed.success ? parsed.data : DEFAULT_ACCESS_POLICY_MODE;
33678
33629
  }
33679
33630
 
33680
33631
  // src/security/access-constraint-deriver/deriver.ts
@@ -34386,7 +34337,7 @@ function recordToOutcomeStore(taskDescription, success, durationMs, opts) {
34386
34337
  const cli = opts?.actualCli ?? match?.primaryCli ?? DEFAULT_CLI;
34387
34338
  const category = match?.category ?? "exploration";
34388
34339
  getOutcomeStore().append({
34389
- id: `orch-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
34340
+ id: `orch-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
34390
34341
  cli,
34391
34342
  category,
34392
34343
  model: "orchestrator",
@@ -34651,11 +34602,14 @@ async function runOrchestratorWithStateTracking(params) {
34651
34602
  });
34652
34603
  }
34653
34604
  function isTaskStateEnabled() {
34654
- return process.env["NEXUS_TASK_STATE_ENABLED"] === "1";
34605
+ const raw = process.env["NEXUS_TASK_STATE_ENABLED"];
34606
+ if (raw === void 0 || raw === "") return true;
34607
+ const normalized = raw.toLowerCase();
34608
+ return normalized !== "0" && normalized !== "false";
34655
34609
  }
34656
34610
  function recordTaskStateInit(taskId, taskText, logger55) {
34657
34611
  if (!isTaskStateEnabled()) return;
34658
- const now = (/* @__PURE__ */ new Date()).toISOString();
34612
+ const now = getTimeProvider().nowIso();
34659
34613
  const initial = {
34660
34614
  taskId,
34661
34615
  stage: "planning",
@@ -34675,7 +34629,7 @@ function recordTaskStateInit(taskId, taskText, logger55) {
34675
34629
  }
34676
34630
  function recordTaskStateStage(taskId, stage, logger55) {
34677
34631
  if (!isTaskStateEnabled()) return;
34678
- const result = updateStage(taskId, stage, (/* @__PURE__ */ new Date()).toISOString());
34632
+ const result = updateStage(taskId, stage, getTimeProvider().nowIso());
34679
34633
  if (!result.ok) {
34680
34634
  logger55.warn("task-state: stage update failed", {
34681
34635
  taskId,
@@ -34686,7 +34640,7 @@ function recordTaskStateStage(taskId, stage, logger55) {
34686
34640
  }
34687
34641
  function recordTaskStateBlocker(taskId, blocker, logger55) {
34688
34642
  if (!isTaskStateEnabled()) return;
34689
- const ts = (/* @__PURE__ */ new Date()).toISOString();
34643
+ const ts = getTimeProvider().nowIso();
34690
34644
  const result = appendBlocker(taskId, { ts, blocker });
34691
34645
  if (!result.ok) {
34692
34646
  logger55.warn("task-state: blocker record failed", {
@@ -34721,7 +34675,7 @@ async function deriveOrchestratePolicy(taskText, deps, logger55) {
34721
34675
  allowedPathPatterns: [],
34722
34676
  allowedOperations: "*",
34723
34677
  objectiveHash: "derivation-failed",
34724
- derivedAt: (/* @__PURE__ */ new Date()).toISOString(),
34678
+ derivedAt: getTimeProvider().nowIso(),
34725
34679
  source: "bypass",
34726
34680
  mode: "off"
34727
34681
  };
@@ -35328,7 +35282,7 @@ function recordToOutcomeStore2(task, model, startMs, governance) {
35328
35282
  qualitySignals.push(`governance:${governance.domain}`);
35329
35283
  }
35330
35284
  getOutcomeStore().append({
35331
- id: `del-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
35285
+ id: `del-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
35332
35286
  cli,
35333
35287
  category: match?.category ?? "exploration",
35334
35288
  model,
@@ -36545,7 +36499,7 @@ function recordExpertOutcome2(opts) {
36545
36499
  try {
36546
36500
  const match = detectTaskCategory(opts.task);
36547
36501
  getOutcomeStore().append({
36548
- id: `exp-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
36502
+ id: `exp-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
36549
36503
  cli: match?.primaryCli ?? DEFAULT_CLI,
36550
36504
  category: resolveExpertCategory(opts),
36551
36505
  model: opts.model ?? "expert",
@@ -36805,7 +36759,7 @@ async function deriveExpertAccessPolicy(task, logger55) {
36805
36759
  allowedPathPatterns: [],
36806
36760
  allowedOperations: "*",
36807
36761
  objectiveHash: "derivation-failed",
36808
- derivedAt: (/* @__PURE__ */ new Date()).toISOString(),
36762
+ derivedAt: getTimeProvider().nowIso(),
36809
36763
  source: "bypass",
36810
36764
  mode: "off"
36811
36765
  };
@@ -38971,7 +38925,7 @@ function recordDiscoveryOutcome(success, durationMs, errorMsg) {
38971
38925
  }
38972
38926
  const store = getOutcomeStore();
38973
38927
  store.append({
38974
- id: `research-discover-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
38928
+ id: `research-discover-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
38975
38929
  cli: DEFAULT_CLI,
38976
38930
  category: "research",
38977
38931
  model: "research-discover",
@@ -39641,7 +39595,7 @@ function recordTriageOutcome(success, durationMs, errorMsg) {
39641
39595
  }
39642
39596
  const store = getOutcomeStore();
39643
39597
  store.append({
39644
- id: `triage-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
39598
+ id: `triage-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
39645
39599
  cli: DEFAULT_CLI,
39646
39600
  category: "planning",
39647
39601
  model: "issue-triage",
@@ -40017,7 +39971,7 @@ function recordGraphWorkflowResult(result) {
40017
39971
  try {
40018
39972
  const store = getOutcomeStore();
40019
39973
  store.append({
40020
- id: `graph-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
39974
+ id: `graph-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
40021
39975
  cli: DEFAULT_CLI,
40022
39976
  category: workflowToCategory(result.workflow),
40023
39977
  model: "graph-workflow",
@@ -40593,7 +40547,7 @@ function recordSpecOutcome(success, durationMs, stage) {
40593
40547
  }
40594
40548
  const store = getOutcomeStore();
40595
40549
  store.append({
40596
- id: `spec-${String(Date.now())}-${Math.random().toString(36).slice(2, 8)}`,
40550
+ id: `spec-${String(getTimeProvider().now())}-${getRandomProvider().random().toString(36).slice(2, 8)}`,
40597
40551
  cli: DEFAULT_CLI,
40598
40552
  category: "code_generation",
40599
40553
  model: "spec-executor",
@@ -41947,7 +41901,7 @@ async function tryIssueTriage(task) {
41947
41901
  try {
41948
41902
  const issueMatch = task.match(/github\.com\/([^/]+\/[^/]+)\/issues\/(\d+)/);
41949
41903
  if (issueMatch === null) return null;
41950
- const { createIssueTriage } = await import("./issue-triage-VLP2PXR6.js");
41904
+ const { createIssueTriage } = await import("./issue-triage-2YK6NOJD.js");
41951
41905
  const triage = createIssueTriage();
41952
41906
  const owner = issueMatch[1] ?? "";
41953
41907
  const num = issueMatch[2] ?? "";
@@ -42978,7 +42932,7 @@ ${contextBlock}`;
42978
42932
  const strategy = config.votingStrategy ?? "higher_order";
42979
42933
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
42980
42934
  try {
42981
- const { executeVoting } = await import("./consensus-vote-N5RRFYER.js");
42935
+ const { executeVoting } = await import("./consensus-vote-VFTADRFB.js");
42982
42936
  const votingResult = await executeVoting(
42983
42937
  {
42984
42938
  proposal: plan.slice(0, 4e3),
@@ -54501,4 +54455,4 @@ export {
54501
54455
  detectBackend,
54502
54456
  createTaskTracker
54503
54457
  };
54504
- //# sourceMappingURL=chunk-APQJV46Q.js.map
54458
+ //# sourceMappingURL=chunk-B6AFGOS5.js.map