@tangle-network/agent-eval 0.105.0 → 0.106.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.
@@ -1,9 +1,9 @@
1
- import { S as Scenario, M as MutableSurface, b as DispatchContext, a as JudgeConfig, f as SurfaceProposer, g as Gate, L as LabeledScenarioStore, C as CampaignResult, j as GateDecision } from '../types-Mh6I44ub.js';
2
- export { k as CampaignAggregates, l as CampaignArtifactWriter, m as CampaignCellResult, n as CampaignCostMeter, d as CampaignTraceWriter, o as CodeSurface, D as Dispatch, h as GateContext, G as GateResult, p as GenerationCandidate, e as GenerationRecord, c as JudgeDimension, J as JudgeScore, i as Mutator, O as OptimizationProposer, q as OptimizerConfig, r as SessionScript } from '../types-Mh6I44ub.js';
3
- import { L as LoopProvenanceRecord, R as RunEvalOptions } from '../provenance-phkRBl4h.js';
4
- export { A as AxisEvidence, a as AxisVerdict, B as BuildEvidenceVectorOptions, D as DefaultProductionGateOptions, E as EvidenceVector, b as EvolutionaryProposerOptions, H as HeldOutGateOptions, O as ObjectiveSource, P as ParetoSignificanceGateOptions, c as PromotionObjective, d as PromotionPolicy, e as buildEvidenceVector, f as composeGate, g as defaultProductionGate, h as evolutionaryProposer, i as heldOutGate, p as paretoPolicy, j as paretoSignificanceGate, r as runEval } from '../provenance-phkRBl4h.js';
5
- import { C as CampaignStorage, a as RunOptimizationOptions, b as RunImprovementLoopResult } from '../gepa-Dn0gtj9n.js';
6
- export { G as GepaProposerOptions, R as RunCampaignOptions, c as RunImprovementLoopOptions, f as fsCampaignStorage, g as gepaProposer, i as inMemoryCampaignStorage, r as runCampaign, d as runImprovementLoop } from '../gepa-Dn0gtj9n.js';
1
+ import { S as Scenario, M as MutableSurface, b as DispatchContext, a as JudgeConfig, f as SurfaceProposer, g as Gate, L as LabeledScenarioStore, C as CampaignResult, h as GateDecision } from '../types-Ctf7XIAL.js';
2
+ export { i as CampaignAggregates, j as CampaignArtifactWriter, k as CampaignCellResult, l as CampaignCostMeter, d as CampaignTraceWriter, m as CodeSurface, D as Dispatch, n as GateContext, G as GateResult, o as GenerationCandidate, e as GenerationRecord, c as JudgeDimension, J as JudgeScore, p as Mutator, O as OptimizationProposer, q as OptimizerConfig, r as SessionScript } from '../types-Ctf7XIAL.js';
3
+ import { L as LoopProvenanceRecord, P as PowerPreflight, R as RunEvalOptions } from '../provenance-HDy5TtOY.js';
4
+ export { A as AxisEvidence, a as AxisVerdict, B as BuildEvidenceVectorOptions, D as DefaultProductionGateOptions, E as EvidenceVector, b as EvolutionaryProposerOptions, H as HeldOutGateOptions, O as ObjectiveSource, c as ParetoSignificanceGateOptions, d as PromotionObjective, e as PromotionPolicy, f as buildEvidenceVector, g as composeGate, h as defaultProductionGate, i as evolutionaryProposer, j as heldOutGate, p as paretoPolicy, k as paretoSignificanceGate, r as runEval } from '../provenance-HDy5TtOY.js';
5
+ import { C as CampaignStorage, R as RunOptimizationOptions, a as RunImprovementLoopResult } from '../gepa-DQ3ruj18.js';
6
+ export { G as GepaProposerOptions, b as RunCampaignOptions, c as RunImprovementLoopOptions, f as fsCampaignStorage, g as gepaProposer, i as inMemoryCampaignStorage, r as runCampaign, d as runImprovementLoop } from '../gepa-DQ3ruj18.js';
7
7
  export { D as DeploymentOutcome, F as FileSystemOutcomeStore, a as FileSystemOutcomeStoreOptions, I as InMemoryOutcomeStore, b as OutcomeStore } from '../outcome-store-rnXLEqSn.js';
8
8
  import { HostedTenant, EvalRunCellScore, EvalRunGenerationSnapshot, EvalRunEvent, TraceSpanEvent } from '../hosted/index.js';
9
9
  import { R as RunRecord, b as RunSplitTag } from '../run-record-I-Z3JNvO.js';
@@ -45,7 +45,7 @@ import 'zod';
45
45
  *
46
46
  * Defaults:
47
47
  * - In-memory storage (no filesystem touch).
48
- * - `gepaProposer` reflective mutation with copywriting-flavored primitives
48
+ * - `gepaProposer` reflective mutation with domain-neutral engineering primitives
49
49
  * (override `proposer` or `mutationPrimitives` for any domain).
50
50
  * - `defaultProductionGate` with `deltaThreshold: 0.05`.
51
51
  * - Held-out split = 25% of scenarios, deterministic by id hash.
@@ -108,6 +108,12 @@ type SelfImproveProgressEvent = {
108
108
  kind: 'gate.decided';
109
109
  decision: string;
110
110
  lift: number;
111
+ } | {
112
+ kind: 'power.estimated';
113
+ n: number;
114
+ sd: number;
115
+ mde: number;
116
+ underpowered: boolean;
111
117
  };
112
118
  interface SelfImproveOptions<TScenario extends Scenario, TArtifact> {
113
119
  /**
@@ -277,6 +283,11 @@ interface SelfImproveResult<TScenario extends Scenario, TArtifact> {
277
283
  * Hosted-tier dashboards render this as the v3-vs-v4 decision view.
278
284
  */
279
285
  insight: InsightReport;
286
+ /** Minimum-detectable-lift analysis from the baseline holdout cells: could this
287
+ * budget have shipped ANY plausible effect? Absent when the baseline produced
288
+ * fewer than 3 scored holdout cells. See `powerPreflight` for the standalone
289
+ * pre-run version (run `gate: 'none'` first, budget the real search after). */
290
+ power?: PowerPreflight;
280
291
  /**
281
292
  * Raw substrate result for advanced inspection — full per-generation
282
293
  * candidates, full campaign artifacts, all judge scores. Useful for
@@ -17,8 +17,9 @@ import {
17
17
  evolutionaryProposer,
18
18
  paretoPolicy,
19
19
  paretoSignificanceGate,
20
+ powerPreflight,
20
21
  runEval
21
- } from "../chunk-Z7FK73R5.js";
22
+ } from "../chunk-JTSA52OJ.js";
22
23
  import {
23
24
  analyzeRuns
24
25
  } from "../chunk-GDZAWO2I.js";
@@ -28,7 +29,7 @@ import {
28
29
  heldOutGate,
29
30
  runImprovementLoop,
30
31
  surfaceContentHash
31
- } from "../chunk-ZKIL3VOD.js";
32
+ } from "../chunk-Y7RY553D.js";
32
33
  import {
33
34
  fsCampaignStorage,
34
35
  inMemoryCampaignStorage,
@@ -95,12 +96,6 @@ function meanComposite(byScenario) {
95
96
  perScenario
96
97
  };
97
98
  }
98
- var DEFAULT_MUTATION_PRIMITIVES = [
99
- "Tighten the hook: lead with the specific user outcome.",
100
- "Replace generic adjectives with specific verbs or proof numbers.",
101
- "Anchor every claim in something the scenario's brief literally supports.",
102
- "Honor the surface-shape constraint (length, register, audience vocabulary)."
103
- ];
104
99
  async function selfImprove(opts) {
105
100
  const startedAt = Date.now();
106
101
  const budget = opts.budget ?? {};
@@ -130,7 +125,9 @@ async function selfImprove(opts) {
130
125
  },
131
126
  model: opts.llm?.model ?? "anthropic/claude-sonnet-4.6",
132
127
  target: opts.proposerTarget ?? "agent surface (system prompt or config) being optimized by selfImprove",
133
- mutationPrimitives: opts.mutationPrimitives ?? DEFAULT_MUTATION_PRIMITIVES
128
+ // Pass-through: when unset, gepaProposer falls back to its own
129
+ // domain-neutral engineering primitives.
130
+ mutationPrimitives: opts.mutationPrimitives
134
131
  });
135
132
  const gate = opts.gate ?? defaultProductionGate({
136
133
  holdoutScenarios: holdout,
@@ -170,6 +167,29 @@ async function selfImprove(opts) {
170
167
  });
171
168
  const baseline = meanComposite(result.baselineOnHoldout.aggregates.byScenario);
172
169
  const winnerStats = meanComposite(result.winnerOnHoldout.aggregates.byScenario);
170
+ let power;
171
+ const baselineHoldoutComposites = result.baselineOnHoldout.cells.filter((cell) => !cell.error).map((cell) => {
172
+ const scores = Object.values(cell.judgeScores);
173
+ return scores.length === 0 ? Number.NaN : scores.reduce((sum, s) => sum + s.composite, 0) / scores.length;
174
+ }).filter((v) => Number.isFinite(v));
175
+ if (baselineHoldoutComposites.length >= 3) {
176
+ power = powerPreflight({
177
+ baselineComposites: baselineHoldoutComposites,
178
+ sharedScorerChannel: true
179
+ });
180
+ if (opts.onProgress) {
181
+ opts.onProgress({
182
+ kind: "power.estimated",
183
+ n: power.n,
184
+ sd: power.sd,
185
+ mde: power.mde,
186
+ underpowered: power.underpowered
187
+ });
188
+ }
189
+ if (power.underpowered && generations > 0) {
190
+ console.warn(`[selfImprove] ${power.recommendation}`);
191
+ }
192
+ }
173
193
  if (opts.onProgress) {
174
194
  opts.onProgress({
175
195
  kind: "baseline.completed",
@@ -237,6 +257,7 @@ async function selfImprove(opts) {
237
257
  durationMs,
238
258
  totalCostUsd: totalCost,
239
259
  insight,
260
+ ...power ? { power } : {},
240
261
  raw: result
241
262
  };
242
263
  if (opts.hostedTenant) {