nexus-agents 4.29.5 → 4.29.6

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-PMTH6YFL.js";
3
+ } from "./chunk-RN2LHUXX.js";
4
4
  import {
5
5
  emitClawGuardViolation
6
6
  } from "./chunk-ULZFVZFW.js";
@@ -2116,4 +2116,4 @@ export {
2116
2116
  VOTING_THRESHOLDS,
2117
2117
  ConsensusMetricsSchema
2118
2118
  };
2119
- //# sourceMappingURL=chunk-Q7GOBLAY.js.map
2119
+ //# sourceMappingURL=chunk-6FQTJHBL.js.map
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-OQB3XC5O.js";
7
7
  import {
8
8
  VERSION
9
- } from "./chunk-PMTH6YFL.js";
9
+ } from "./chunk-RN2LHUXX.js";
10
10
  import {
11
11
  capitalize
12
12
  } from "./chunk-6T3EPABN.js";
@@ -1201,7 +1201,7 @@ async function runDoctorFix(result) {
1201
1201
  writeLine2("\u2500".repeat(40));
1202
1202
  let fixCount = 0;
1203
1203
  if (!result.dataDirectory.rootExists || result.dataDirectory.subdirectories.some((d) => !d.exists || !d.writable)) {
1204
- const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-IO5SZULH.js");
1204
+ const { initDataDirectories: initDataDirectories2, describeDataDirFix: describeDataDirFix2 } = await import("./setup-data-dir-I35NTAVH.js");
1205
1205
  const outcome = describeDataDirFix2(initDataDirectories2());
1206
1206
  writeLine2(outcome.line);
1207
1207
  if (outcome.counted) fixCount++;
@@ -1303,4 +1303,4 @@ export {
1303
1303
  startStdioServer,
1304
1304
  closeServer
1305
1305
  };
1306
- //# sourceMappingURL=chunk-I4M3ICTG.js.map
1306
+ //# sourceMappingURL=chunk-7BX54AST.js.map
@@ -21,7 +21,7 @@ import {
21
21
  import {
22
22
  DEFAULT_TASK_TTL_MS,
23
23
  clampTaskTtl
24
- } from "./chunk-I4M3ICTG.js";
24
+ } from "./chunk-7BX54AST.js";
25
25
  import {
26
26
  executeExpert
27
27
  } from "./chunk-UPKYWLPL.js";
@@ -47,7 +47,7 @@ import {
47
47
  simulationDeniedResult,
48
48
  toJobSummary,
49
49
  writeJobCancelled
50
- } from "./chunk-S6AUSZVL.js";
50
+ } from "./chunk-T6GDTQPM.js";
51
51
  import {
52
52
  allOf
53
53
  } from "./chunk-OQB3XC5O.js";
@@ -64,7 +64,7 @@ import {
64
64
  } from "./chunk-3IM3OPZH.js";
65
65
  import {
66
66
  withPrerequisite
67
- } from "./chunk-ZRBUE6WG.js";
67
+ } from "./chunk-UMT3WDMH.js";
68
68
  import {
69
69
  NOOP_NOTIFIER,
70
70
  RateLimiter,
@@ -88,7 +88,7 @@ import {
88
88
  withAuditTrail,
89
89
  withProgressHeartbeat,
90
90
  wrapToolWithTimeout
91
- } from "./chunk-Q7GOBLAY.js";
91
+ } from "./chunk-6FQTJHBL.js";
92
92
  import {
93
93
  createAuditTrail,
94
94
  createGraphAuditBridge,
@@ -19615,6 +19615,10 @@ var MODEL_CAPABILITIES = {
19615
19615
  var capabilityRegistry = new Map(Object.entries(MODEL_CAPABILITIES));
19616
19616
 
19617
19617
  // src/agents/orchestration/puppeteer-config-types.ts
19618
+ var DEFAULT_COST_PER_1K_TOKENS = 0.01;
19619
+ function tokensToCostUsd(tokens, costPer1KTokens) {
19620
+ return tokens * costPer1KTokens / 1e3;
19621
+ }
19618
19622
  var DEFAULT_PUPPETEER_CONFIG = {
19619
19623
  maxSteps: 10,
19620
19624
  timeoutMs: 5 * 60 * 1e3,
@@ -19623,7 +19627,7 @@ var DEFAULT_PUPPETEER_CONFIG = {
19623
19627
  discountFactor: 0.99,
19624
19628
  explorationRate: 0.1,
19625
19629
  trackEmergentPatterns: true,
19626
- costPer1KTokens: 0.01,
19630
+ costPer1KTokens: DEFAULT_COST_PER_1K_TOKENS,
19627
19631
  maxCostBudget: 1
19628
19632
  };
19629
19633
 
@@ -19748,7 +19752,8 @@ var LearnablePolicyStatsSchema = z43.object({
19748
19752
  // src/agents/orchestration/state-manager.ts
19749
19753
  var DEFAULT_STATE_MANAGER_CONFIG = {
19750
19754
  maxContextTokens: 8e3,
19751
- compressionThreshold: 0.8
19755
+ compressionThreshold: 0.8,
19756
+ costPer1KTokens: DEFAULT_COST_PER_1K_TOKENS
19752
19757
  };
19753
19758
  var STOPWORDS2 = /* @__PURE__ */ new Set([
19754
19759
  "the",
@@ -19955,11 +19960,10 @@ var StateManager = class {
19955
19960
  updateMetadata(current, output2) {
19956
19961
  const startTime = new Date(current.startedAt).getTime();
19957
19962
  const elapsedMs = getTimeProvider().now() - startTime;
19958
- const costPerToken = 1e-5;
19959
19963
  const measured = output2.tokensMeasured !== false;
19960
19964
  return {
19961
19965
  progress: current.progress,
19962
- totalCost: current.totalCost + (measured ? output2.tokensUsed * costPerToken : 0),
19966
+ totalCost: current.totalCost + (measured ? tokensToCostUsd(output2.tokensUsed, this.config.costPer1KTokens) : 0),
19963
19967
  totalTokens: current.totalTokens + (measured ? output2.tokensUsed : 0),
19964
19968
  unmeasuredSteps: (current.unmeasuredSteps ?? 0) + (measured ? 0 : 1),
19965
19969
  elapsedMs,
@@ -20885,12 +20889,13 @@ var DEFAULT_REWARD_CONFIG = {
20885
20889
  efficiencyWeight: 0.1,
20886
20890
  progressWeight: 0.5,
20887
20891
  maxCost: 1,
20888
- maxTime: 3e5
20892
+ maxTime: 3e5,
20893
+ costPer1KTokens: DEFAULT_COST_PER_1K_TOKENS
20889
20894
  };
20890
20895
  function computeStepReward(output2, progressDelta, config = DEFAULT_REWARD_CONFIG) {
20891
20896
  if (output2.tokensMeasured === false) return null;
20892
20897
  const progressReward = progressDelta * config.progressWeight;
20893
- const costPenalty = output2.tokensUsed * 1e-5 / config.maxCost;
20898
+ const costPenalty = tokensToCostUsd(output2.tokensUsed, config.costPer1KTokens) / config.maxCost;
20894
20899
  const timePenalty = output2.durationMs / config.maxTime;
20895
20900
  const efficiencyPenalty = (costPenalty + timePenalty) * config.efficiencyWeight;
20896
20901
  return progressReward - efficiencyPenalty;
@@ -20963,13 +20968,14 @@ function computeMetrics(trajectory, emergentPatterns, success) {
20963
20968
  cyclicalityScore: emergentPatterns.cyclicalityScore
20964
20969
  };
20965
20970
  }
20966
- function buildPuppeteerResult(trajectory, emergentPatterns, terminationReason, sessionId, startTime) {
20971
+ function buildPuppeteerResult(trajectory, emergentPatterns, terminationReason, options) {
20972
+ const { sessionId, startTime, costPer1KTokens = DEFAULT_COST_PER_1K_TOKENS } = options;
20967
20973
  const success = terminationReason === "task_complete";
20968
20974
  const totalDurationMs = getTimeProvider().now() - startTime;
20969
20975
  const lastStep = trajectory[trajectory.length - 1];
20970
20976
  const output2 = lastStep?.agentOutput.output ?? null;
20971
20977
  const totalTokens = trajectory.reduce((sum, s) => sum + s.agentOutput.tokensUsed, 0);
20972
- const totalCost = totalTokens * 1e-5;
20978
+ const totalCost = tokensToCostUsd(totalTokens, costPer1KTokens);
20973
20979
  const metrics = computeMetrics(trajectory, emergentPatterns, success);
20974
20980
  return {
20975
20981
  success,
@@ -21695,7 +21701,7 @@ var PuppeteerOrchestrator = class {
21695
21701
  constructor(options = {}) {
21696
21702
  this.config = { ...DEFAULT_PUPPETEER_CONFIG, ...options.config };
21697
21703
  this.policyEngine = options.policyEngine ?? createPolicyForMode(this.config.policyMode);
21698
- this.stateManager = options.stateManager ?? createStateManager();
21704
+ this.stateManager = options.stateManager ?? createStateManager({ costPer1KTokens: this.config.costPer1KTokens });
21699
21705
  this.patternTracker = options.patternTracker ?? createPatternTracker();
21700
21706
  this.eventBus = options.eventBus ?? void 0;
21701
21707
  this.agents = /* @__PURE__ */ new Map();
@@ -21846,7 +21852,11 @@ var PuppeteerOrchestrator = class {
21846
21852
  const terminationCtx = { config: this.config, cancelled: this.cancelled };
21847
21853
  const reason = determineTerminationReason(terminationCtx, state, trajectory, startTime);
21848
21854
  const emergentPatterns = this.config.trackEmergentPatterns ? this.patternTracker.analyze(trajectory) : { hubAgents: [], cycles: [], graphDensity: 0, cyclicalityScore: 0 };
21849
- const result = buildPuppeteerResult(trajectory, emergentPatterns, reason, sessionId, startTime);
21855
+ const result = buildPuppeteerResult(trajectory, emergentPatterns, reason, {
21856
+ sessionId,
21857
+ startTime,
21858
+ costPer1KTokens: this.config.costPer1KTokens
21859
+ });
21850
21860
  if (this.experienceBuffer !== null && supportsLearning(this.policyEngine)) {
21851
21861
  void processOrchestrationForLearning(result, this.experienceBuffer, this.policyEngine);
21852
21862
  }
@@ -21865,7 +21875,11 @@ var PuppeteerOrchestrator = class {
21865
21875
  }
21866
21876
  buildErrorResult(trajectory, reason, sessionId, startTime) {
21867
21877
  const emergentPatterns = this.config.trackEmergentPatterns ? this.patternTracker.analyze(trajectory) : { hubAgents: [], cycles: [], graphDensity: 0, cyclicalityScore: 0 };
21868
- const result = buildPuppeteerResult(trajectory, emergentPatterns, reason, sessionId, startTime);
21878
+ const result = buildPuppeteerResult(trajectory, emergentPatterns, reason, {
21879
+ sessionId,
21880
+ startTime,
21881
+ costPer1KTokens: this.config.costPer1KTokens
21882
+ });
21869
21883
  this.cleanupAbortSignal();
21870
21884
  return ok(result);
21871
21885
  }
@@ -47523,7 +47537,7 @@ ${contextBlock}`;
47523
47537
  const strategy = config.votingStrategy ?? "higher_order";
47524
47538
  await postProgress(config, "Vote", `Running consensus with ${strategy} strategy...`);
47525
47539
  try {
47526
- const { executeVoting } = await import("./consensus-vote-ITFU2C77.js");
47540
+ const { executeVoting } = await import("./consensus-vote-6GHVEPJO.js");
47527
47541
  const votingResult = await executeVoting(
47528
47542
  {
47529
47543
  proposal: buildVoteProposal(plan, research),
@@ -56151,4 +56165,4 @@ export {
56151
56165
  shutdownFeedbackSubscriber,
56152
56166
  createEventBusBridge
56153
56167
  };
56154
- //# sourceMappingURL=chunk-5RIAPSAF.js.map
56168
+ //# sourceMappingURL=chunk-IIKPFM4S.js.map