@tangle-network/agent-eval 0.122.2 → 0.122.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.
@@ -15,7 +15,7 @@ import {
15
15
  runImprovementLoop,
16
16
  surfaceContentHash,
17
17
  surfaceHash
18
- } from "./chunk-U4R2AGY5.js";
18
+ } from "./chunk-DHJJACEX.js";
19
19
  import {
20
20
  SearchLedgerConflictError,
21
21
  SearchLedgerError,
@@ -33,12 +33,10 @@ import {
33
33
  tryAcquireAtomicFileLock,
34
34
  withSearchLedgerFileLock
35
35
  } from "./chunk-N3QPYIVG.js";
36
- import {
37
- Mutex
38
- } from "./chunk-3YYRZDON.js";
39
36
  import {
40
37
  AnalystRegistry,
41
38
  DEFAULT_TRACE_ANALYST_KINDS,
39
+ Mutex,
42
40
  POLICY_EDIT_AXES,
43
41
  POLICY_EDIT_TARGET_SURFACES,
44
42
  admitPolicyEdit,
@@ -49,9 +47,10 @@ import {
49
47
  isPolicyEdit,
50
48
  makePolicyEdit,
51
49
  makePolicyEditCandidateRecord,
50
+ mapConcurrent,
52
51
  policyEditsFromFindings,
53
52
  validatePolicyEditCandidateRecord
54
- } from "./chunk-5CVUPHJ4.js";
53
+ } from "./chunk-EAWKAVID.js";
55
54
  import {
56
55
  callLlm,
57
56
  callLlmJson,
@@ -4214,9 +4213,13 @@ function toCandidate(p) {
4214
4213
  async function runLineageLoop(opts) {
4215
4214
  const governor = opts.governor ?? heuristicGovernor();
4216
4215
  const populationSize = opts.populationSize ?? 4;
4216
+ const candidateConcurrency = opts.candidateConcurrency ?? 1;
4217
4217
  if (populationSize < 1) {
4218
4218
  throw new Error("runLineageLoop: populationSize must be >= 1");
4219
4219
  }
4220
+ if (!Number.isInteger(candidateConcurrency) || candidateConcurrency < 1) {
4221
+ throw new Error("runLineageLoop: candidateConcurrency must be a positive integer");
4222
+ }
4220
4223
  let proposer = opts.proposer;
4221
4224
  if (!proposer) {
4222
4225
  if (!opts.llm || !opts.model) {
@@ -4282,18 +4285,17 @@ async function runLineageLoop(opts) {
4282
4285
  objectives.composite = node.score;
4283
4286
  return objectives;
4284
4287
  };
4285
- const scoredSeeds = [];
4286
- for (const seed of opts.seeds) {
4288
+ const scoredSeeds = await mapConcurrent(opts.seeds, candidateConcurrency, async (seed) => {
4287
4289
  const measured = await scoreSurface(seed.surface);
4288
- scoredSeeds.push({
4290
+ return {
4289
4291
  surface: seed.surface,
4290
4292
  track: seed.track,
4291
4293
  proposer: seed.proposer,
4292
4294
  score: measured.score,
4293
4295
  ...seed.vision !== void 0 ? { vision: seed.vision } : {},
4294
4296
  ...measured.scoreVector !== void 0 ? { scoreVector: measured.scoreVector } : {}
4295
- });
4296
- }
4297
+ };
4298
+ });
4297
4299
  const step = async (args) => {
4298
4300
  const proposed = await proposer.propose({
4299
4301
  currentSurface: args.tip.surface,
@@ -4312,16 +4314,21 @@ async function runLineageLoop(opts) {
4312
4314
  ...args.tip.rationale !== void 0 ? { rationale: args.tip.rationale } : {}
4313
4315
  }
4314
4316
  ];
4315
- for (const p of proposed) {
4316
- const { surface, rationale } = toCandidate(p);
4317
- const measured = await scoreSurface(surface);
4318
- pool.push({
4319
- surface,
4320
- score: measured.score,
4321
- ...measured.scoreVector !== void 0 ? { scoreVector: measured.scoreVector } : {},
4322
- ...rationale !== void 0 ? { rationale } : {}
4323
- });
4324
- }
4317
+ const measuredCandidates = await mapConcurrent(
4318
+ proposed,
4319
+ candidateConcurrency,
4320
+ async (p) => {
4321
+ const { surface, rationale } = toCandidate(p);
4322
+ const measured = await scoreSurface(surface);
4323
+ return {
4324
+ surface,
4325
+ score: measured.score,
4326
+ ...measured.scoreVector !== void 0 ? { scoreVector: measured.scoreVector } : {},
4327
+ ...rationale !== void 0 ? { rationale } : {}
4328
+ };
4329
+ }
4330
+ );
4331
+ pool.push(...measuredCandidates);
4325
4332
  let best = pool[0];
4326
4333
  for (const entry of pool) {
4327
4334
  if (entry.score > best.score) best = entry;
@@ -8116,4 +8123,4 @@ export {
8116
8123
  verifyCodeSurface,
8117
8124
  resolveWorktreePath
8118
8125
  };
8119
- //# sourceMappingURL=chunk-EXMKNOP5.js.map
8126
+ //# sourceMappingURL=chunk-IDC74VDL.js.map