@tangle-network/agent-eval 0.98.0 → 0.100.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.
Files changed (43) hide show
  1. package/dist/adapters/http.d.ts +1 -1
  2. package/dist/adapters/langchain.d.ts +1 -1
  3. package/dist/adapters/otel.d.ts +1 -1
  4. package/dist/adversarial-B7loGVVX.d.ts +19 -0
  5. package/dist/analyst/index.js +3 -2
  6. package/dist/analyst/index.js.map +1 -1
  7. package/dist/campaign/index.d.ts +9 -8
  8. package/dist/campaign/index.js +4 -1
  9. package/dist/campaign/index.js.map +1 -1
  10. package/dist/chunk-BUTW4RGG.js +32 -0
  11. package/dist/chunk-BUTW4RGG.js.map +1 -0
  12. package/dist/{chunk-QWV226SL.js → chunk-JHCHEVET.js} +1 -3
  13. package/dist/chunk-OYU4D7FY.js +718 -0
  14. package/dist/chunk-OYU4D7FY.js.map +1 -0
  15. package/dist/{chunk-PSWWQXHF.js → chunk-SJISCGWD.js} +5 -30
  16. package/dist/chunk-SJISCGWD.js.map +1 -0
  17. package/dist/contract/index.d.ts +6 -6
  18. package/dist/fuzz.d.ts +1 -1
  19. package/dist/{gepa-3TG16SYf.d.ts → gepa-H6mlM0KN.d.ts} +1 -1
  20. package/dist/groundedness/index.d.ts +112 -0
  21. package/dist/groundedness/index.js +77 -0
  22. package/dist/groundedness/index.js.map +1 -0
  23. package/dist/hosted/index.d.ts +1 -1
  24. package/dist/index.d.ts +329 -14
  25. package/dist/index.js +195 -244
  26. package/dist/index.js.map +1 -1
  27. package/dist/matrix/index.d.ts +3 -17
  28. package/dist/matrix/index.js +3 -7
  29. package/dist/multishot/index.d.ts +1 -1
  30. package/dist/multishot/index.js +1 -1
  31. package/dist/openapi.json +1 -1
  32. package/dist/{pre-registration-nfUdc9EQ.d.ts → pre-registration-CMm8cvrh.d.ts} +73 -1
  33. package/dist/{provenance-C5KAhiom.d.ts → provenance-Bg_RttR8.d.ts} +2 -2
  34. package/dist/rl.d.ts +2 -2
  35. package/dist/rl.js +0 -79
  36. package/dist/rl.js.map +1 -1
  37. package/dist/{types-D9tuReDv.d.ts → types-BTI16iFl.d.ts} +1 -1
  38. package/package.json +6 -1
  39. package/dist/adversarial-DIVcDoI_.d.ts +0 -88
  40. package/dist/chunk-HMA63UEO.js +0 -370
  41. package/dist/chunk-HMA63UEO.js.map +0 -1
  42. package/dist/chunk-PSWWQXHF.js.map +0 -1
  43. /package/dist/{chunk-QWV226SL.js.map → chunk-JHCHEVET.js.map} +0 -0
@@ -1,21 +1,7 @@
1
- import { M as MatrixResult, a as MatrixAxis, A as AxisSummary, b as MatrixCell, C as CellResult, R as RunAgentMatrixOptions } from '../types-BUxNaJ8c.js';
1
+ import { R as RunAgentMatrixOptions, M as MatrixResult } from '../types-BUxNaJ8c.js';
2
+ export { A as AxisSummary, C as CellResult, a as MatrixAxis, b as MatrixCell } from '../types-BUxNaJ8c.js';
2
3
  export { D as DefaultVerdict } from '../verdict-C9MlYujm.js';
3
4
 
4
- /**
5
- * Per-axis aggregation of cell runs into `AxisSummary` rows.
6
- *
7
- * Pure: consumes the final `cells: [{cell, runs}]` array and returns the
8
- * `byAxis` table. Error runs contribute 0 to passRate and meanScore. Cost
9
- * and duration always count — the budget was spent regardless.
10
- */
11
-
12
- interface Row<Output> {
13
- cell: MatrixCell;
14
- result: CellResult<Output>;
15
- }
16
- declare function summariseRows<Output>(rows: Row<Output>[], axisName: string, axisValue: string): AxisSummary;
17
- declare function buildByAxis<Output>(cells: MatrixResult<Output>['cells'], axes: MatrixAxis<unknown>[], aggregateBy: string[]): Record<string, Record<string, AxisSummary>>;
18
-
19
5
  /**
20
6
  * N-axis cartesian runner.
21
7
  *
@@ -31,4 +17,4 @@ declare function buildByAxis<Output>(cells: MatrixResult<Output>['cells'], axes:
31
17
 
32
18
  declare function runAgentMatrix<Output>(opts: RunAgentMatrixOptions<Output>): Promise<MatrixResult<Output>>;
33
19
 
34
- export { AxisSummary, CellResult, MatrixAxis, MatrixCell, MatrixResult, RunAgentMatrixOptions, buildByAxis, runAgentMatrix, summariseRows };
20
+ export { MatrixResult, RunAgentMatrixOptions, runAgentMatrix };
@@ -1,12 +1,8 @@
1
1
  import {
2
- buildByAxis,
3
- runAgentMatrix,
4
- summariseRows
5
- } from "../chunk-QWV226SL.js";
2
+ runAgentMatrix
3
+ } from "../chunk-JHCHEVET.js";
6
4
  import "../chunk-PZ5AY32C.js";
7
5
  export {
8
- buildByAxis,
9
- runAgentMatrix,
10
- summariseRows
6
+ runAgentMatrix
11
7
  };
12
8
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { J as JudgeScore } from '../types-D9tuReDv.js';
1
+ import { J as JudgeScore } from '../types-BTI16iFl.js';
2
2
  import { AgentProfile } from '@tangle-network/agent-interface';
3
3
  import { M as MatrixResult } from '../types-BUxNaJ8c.js';
4
4
  import '../run-record-CP2ObebC.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runAgentMatrix
3
- } from "../chunk-QWV226SL.js";
3
+ } from "../chunk-JHCHEVET.js";
4
4
  import "../chunk-PZ5AY32C.js";
5
5
 
6
6
  // src/multishot/router.ts
package/dist/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "@tangle-network/agent-eval — wire protocol",
5
- "version": "0.98.0",
5
+ "version": "0.100.0",
6
6
  "description": "HTTP and stdio RPC interface to agent-eval. The TypeScript runtime is the source of truth; this spec is the contract that cross-language clients (Python, Rust, Go) generate from.\n\nWire-protocol version: 1.0.0. Bumps on breaking changes to request/response schemas.",
7
7
  "contact": {
8
8
  "name": "Tangle Network",
@@ -1,5 +1,7 @@
1
1
  import { A as AgentEvalError } from './errors-CzMUYo7b.js';
2
2
  import { R as RunRecord } from './run-record-CP2ObebC.js';
3
+ import { C as ChatClient } from './types-B5x54y6n.js';
4
+ import { c as JudgeDimension, S as Scenario, a as JudgeConfig } from './types-BTI16iFl.js';
3
5
  import { TCloud } from '@tangle-network/tcloud';
4
6
  import { D as DefaultVerdict } from './verdict-C9MlYujm.js';
5
7
 
@@ -292,6 +294,76 @@ declare function createTokenRecallChecker(opts?: {
292
294
  minContentLength?: number;
293
295
  }): CorrectnessChecker;
294
296
 
297
+ /**
298
+ * `llmJudge` — the single-LLM-call bridge that turns a rubric prompt into a
299
+ * canonical campaign `JudgeConfig`.
300
+ *
301
+ * The `JudgeConfig` contract (src/campaign/types.ts) is deliberately a
302
+ * function, not a fixed LLM-prompt shape: real consumers judge with
303
+ * ensembles, deterministic checks, or one LLM call. `ensembleJudge`
304
+ * (src/judge-panel.ts) covers the multi-model case; `buildAgreementJudge`
305
+ * (src/campaign/distillation) covers the pure-comparator case. `llmJudge`
306
+ * covers the common single-call case the `JudgeConfig` doc-comment names:
307
+ * one model call against `prompt`, parsed into the canonical `JudgeScore`
308
+ * (`{ dimensions, composite, notes }`) on the campaign [0,1] scale.
309
+ *
310
+ * Transport is injected as a `ChatClient` (src/analyst/chat-client.ts) — the
311
+ * substrate's transport-agnostic LLM seam — so the judge stays decoupled from
312
+ * router-vs-sandbox-vs-cli-bridge and is unit-testable with the `mock`
313
+ * transport. The composite is computed by `weightedComposite` (the same
314
+ * sum-normalized weighting `ensembleJudge` uses), so a lift is attributable to
315
+ * the dimension scores, not to a bespoke reducer.
316
+ *
317
+ * Fail-loud throughout: an unparseable model response throws `JudgeParseError`;
318
+ * a response missing a declared dimension throws; an out-of-range score throws.
319
+ * A thrown judge is recorded by the campaign engine as a failed cell, never
320
+ * folded into a silent zero.
321
+ */
322
+
323
+ /** A rubric dimension as a bare key or the full `{ key, description }` shape. A
324
+ * bare string uses the key as its own description. */
325
+ type LlmJudgeDimension = string | JudgeDimension;
326
+ interface LlmJudgeOptions<TArtifact, TScenario extends Scenario = Scenario> {
327
+ /** The injected LLM transport. One `chat()` call per `score()`. Required —
328
+ * there is no default route, so a misconfigured judge fails at construction,
329
+ * never silently against the free-tier router. */
330
+ chat: ChatClient;
331
+ /** Rubric dimensions the model scores. Each becomes a `[0,1]` field of the
332
+ * returned `JudgeScore.dimensions`. Defaults to a single `quality` dimension. */
333
+ dimensions?: LlmJudgeDimension[];
334
+ /** Model id. Falls back to `chat.defaultModel`; one of the two MUST resolve. */
335
+ model?: string;
336
+ temperature?: number;
337
+ maxTokens?: number;
338
+ /** Composite weights forwarded to `weightedComposite`: a partial map selects
339
+ * AND weights exactly the named dimensions. Omit for a uniform mean. */
340
+ weights?: Record<string, number>;
341
+ /** Scale the model is prompted to score on, normalized into `[0,1]`:
342
+ * - `'unit'` (default): the model returns `[0,1]` directly.
343
+ * - `'ten'`: the model returns `[0,10]`; divided by 10 here.
344
+ * The prompt is annotated with the expected range either way. */
345
+ scale?: 'unit' | 'ten';
346
+ /** Run this judge only on matching scenarios (mirrors `JudgeConfig.appliesTo`). */
347
+ appliesTo?: (scenario: TScenario) => boolean;
348
+ /** Render the artifact + scenario into the user message. Default:
349
+ * pretty-printed JSON of `{ scenario, artifact }`. */
350
+ renderUser?: (input: {
351
+ artifact: TArtifact;
352
+ scenario: TScenario;
353
+ }) => string;
354
+ }
355
+ /**
356
+ * Build a campaign-shaped `JudgeConfig` whose `score()` makes ONE LLM call
357
+ * against `prompt` and reduces the model's per-dimension scores to a canonical
358
+ * `JudgeScore` in `[0,1]`.
359
+ *
360
+ * The model is instructed to return JSON `{ "dimensions": { <key>: <number>, … },
361
+ * "notes": "…" }`; the helper strips fenced JSON, validates every declared
362
+ * dimension is present and in range, normalizes by `scale`, and composites via
363
+ * `weightedComposite`.
364
+ */
365
+ declare function llmJudge<TArtifact = unknown, TScenario extends Scenario = Scenario>(name: string, prompt: string, opts: LlmJudgeOptions<TArtifact, TScenario>): JudgeConfig<TArtifact, TScenario>;
366
+
295
367
  /**
296
368
  * Produced-state extraction — normalize a run's runtime event stream into the
297
369
  * typed `ProducedState` the completion oracle consumes.
@@ -480,4 +552,4 @@ declare function evaluateHypothesis(manifest: SignedManifest, observed: {
480
552
  pValue: number;
481
553
  }): Promise<HypothesisResult>;
482
554
 
483
- export { type Artifact as A, type BackendIntegrityReport as B, type CompletionRequirement as C, parseCorrectnessResponse as D, regexMatch as E, signManifest as F, summarizeBackendIntegrity as G, type HypothesisManifest as H, verifyCompletion as I, verifyManifest as J, type LlmCorrectnessCheckerOpts as L, type ProducedState as P, type RuntimeEventLike as R, type SignedManifest as S, type TaskGold as T, type ValidationContext as V, type CompletionVerdict as a, type CorrectnessChecker as b, type ArtifactEventLike as c, type ArtifactValidator as d, BackendIntegrityError as e, type HypothesisResult as f, type ProducedProposal as g, type ProposalEventLike as h, type RequirementCheck as i, type SatisfiedBy as j, type SignedManifestAlgo as k, type ToolCallEventLike as l, type ValidationIssue as m, type ValidationResult as n, assertRealBackend as o, byteLengthRange as p, canonicalize as q, completionVerdict as r, composeValidators as s, containsAll as t, createLlmCorrectnessChecker as u, createTokenRecallChecker as v, evaluateHypothesis as w, extractProducedState as x, hashJson as y, jsonHasKeys as z };
555
+ export { type Artifact as A, type BackendIntegrityReport as B, type CompletionRequirement as C, extractProducedState as D, hashJson as E, jsonHasKeys as F, parseCorrectnessResponse as G, type HypothesisManifest as H, regexMatch as I, signManifest as J, summarizeBackendIntegrity as K, type LlmJudgeDimension as L, verifyCompletion as M, verifyManifest as N, type ProducedState as P, type RuntimeEventLike as R, type SignedManifest as S, type TaskGold as T, type ValidationContext as V, type CompletionVerdict as a, type CorrectnessChecker as b, type LlmJudgeOptions as c, type ArtifactEventLike as d, type ArtifactValidator as e, BackendIntegrityError as f, type HypothesisResult as g, type LlmCorrectnessCheckerOpts as h, type ProducedProposal as i, type ProposalEventLike as j, type RequirementCheck as k, llmJudge as l, type SatisfiedBy as m, type SignedManifestAlgo as n, type ToolCallEventLike as o, type ValidationIssue as p, type ValidationResult as q, assertRealBackend as r, byteLengthRange as s, canonicalize as t, completionVerdict as u, composeValidators as v, containsAll as w, createLlmCorrectnessChecker as x, createTokenRecallChecker as y, evaluateHypothesis as z };
@@ -1,9 +1,9 @@
1
- import { S as Scenario, f as Gate, G as GateResult, g as GateContext, C as CampaignResult, h as Mutator, e as SurfaceProposer, M as MutableSurface, i as GateDecision } from './types-D9tuReDv.js';
1
+ import { S as Scenario, g as Gate, G as GateResult, h as GateContext, C as CampaignResult, i as Mutator, f as SurfaceProposer, M as MutableSurface, j as GateDecision } from './types-BTI16iFl.js';
2
2
  import { R as RedTeamCase } from './red-team-BWdoyleI.js';
3
3
  import { R as RunRecord } from './run-record-CP2ObebC.js';
4
4
  import { D as Direction } from './pareto-E-pembql.js';
5
5
  import { a as PairedBootstrapResult } from './statistics-xP-cWc5k.js';
6
- import { R as RunCampaignOptions, C as CampaignStorage } from './gepa-3TG16SYf.js';
6
+ import { R as RunCampaignOptions, C as CampaignStorage } from './gepa-H6mlM0KN.js';
7
7
  import { HostedClient, TraceSpanEvent } from './hosted/index.js';
8
8
 
9
9
  /**
package/dist/rl.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { R as RunRecord, a as RunSplitTag } from './run-record-CP2ObebC.js';
2
- export { A as AdversarialMutation, a as AdversarialScenario, b as AdversarialSearchOptions, c as AdversarialSearchReport, d as adversarialScenarioSearch } from './adversarial-DIVcDoI_.js';
2
+ export { A as AdversarialMutation } from './adversarial-B7loGVVX.js';
3
3
  import { P as PreferenceExtractionReport, D as DpoExportRow, G as GrpoExportRow, S as SftExportRow, E as ExtractPreferencesOptions, a as DpoLookups, b as GrpoLookups, c as SftLookups } from './corpus-D4YW9UoJ.js';
4
4
  export { d as CorpusAppendResult, C as CorpusRecord, e as DatasetFormat, f as ExtractStepRewardsOptions, H as HarvestOptions, g as PreferenceStrategy, h as PreferenceTriple, i as PrmExportRow, j as PrmLookups, k as PrmTrainingTriple, R as RewardKind, l as RewardStats, m as RlDatasetBundle, n as RlDatasetConfig, o as RlDatasetManifest, p as RlDatasetStats, q as RunwiseStepSummary, r as StepReward, s as StepRewardJsonlRow, t as StepScorer, u as appendToCorpus, v as buildDatasetFromCorpus, w as buildRlDataset, x as datasheetToMarkdown, y as extractPreferences, z as extractStepRewards, A as prmTrainingPairs, B as readCorpus, F as runwiseStepRewardSummary, I as stepRewardsToJsonl, J as toAnthropicFormat, K as toDpoJsonl, L as toDpoRows, M as toGrpoJsonl, N as toGrpoRows, O as toPrmJsonl, Q as toPrmRows, T as toSftJsonl, U as toSftRows, V as toTRLFormat } from './corpus-D4YW9UoJ.js';
5
5
  export { O as OffPolicyEstimate, a as OffPolicyOptions, b as OffPolicyTrajectory, d as doublyRobust, i as inverseProbabilityWeighting, o as offPolicyEstimateAll, s as selfNormalizedImportanceWeighting } from './off-policy-DiwuKKg7.js';
@@ -10,7 +10,7 @@ import { R as Researcher, F as FailureMode, S as SteeringChange, E as Experiment
10
10
  export { r as runEvalCampaign } from './researcher-Jr8ME1dZ.js';
11
11
  import { a as VerificationReport } from './multi-layer-verifier-DUZXrPDA.js';
12
12
  import { I as InterimReleaseConfidence } from './sequential-5iSVfzl2.js';
13
- import { C as CampaignResult } from './types-D9tuReDv.js';
13
+ import { C as CampaignResult } from './types-BTI16iFl.js';
14
14
  import '@tangle-network/agent-interface';
15
15
  import './errors-CzMUYo7b.js';
16
16
  import './schema-m0gsnbt3.js';
package/dist/rl.js CHANGED
@@ -157,84 +157,6 @@ function bootstrapMeanCi(xs, resamples, confidence, rng) {
157
157
  };
158
158
  }
159
159
 
160
- // src/rl/adversarial.ts
161
- async function adversarialScenarioSearch(opts) {
162
- const failureThreshold = opts.failureThreshold ?? 0.5;
163
- const rounds = opts.rounds ?? 3;
164
- const children = opts.childrenPerParent ?? 4;
165
- const budget = opts.budget ?? Number.POSITIVE_INFINITY;
166
- const seed = opts.seed ?? 1;
167
- const rng = mulberry32(seed);
168
- const scenarios = [];
169
- const seen = /* @__PURE__ */ new Set();
170
- let scoreCalls = 0;
171
- for (const s of opts.seeds) {
172
- const id = opts.mutateScenarioId(s);
173
- if (seen.has(id)) continue;
174
- seen.add(id);
175
- if (scoreCalls >= budget) break;
176
- const score = await opts.scoreFn(s);
177
- scoreCalls++;
178
- scenarios.push({
179
- id,
180
- generation: 0,
181
- parentId: null,
182
- scenario: s,
183
- score,
184
- mutationStrategy: null
185
- });
186
- }
187
- for (let g = 1; g <= rounds; g++) {
188
- if (scoreCalls >= budget) break;
189
- const parents = scenarios.filter((s) => s.generation === g - 1);
190
- for (const parent of parents) {
191
- for (const mutation of opts.mutations) {
192
- if (scoreCalls >= budget) break;
193
- const produced = await mutation.mutate(parent.scenario, rng);
194
- const childArr = Array.isArray(produced) ? produced : [produced];
195
- for (let k = 0; k < Math.min(children, childArr.length); k++) {
196
- if (scoreCalls >= budget) break;
197
- const child = childArr[k];
198
- const cid = opts.mutateScenarioId(child);
199
- if (seen.has(cid)) continue;
200
- seen.add(cid);
201
- const cscore = await opts.scoreFn(child);
202
- scoreCalls++;
203
- scenarios.push({
204
- id: cid,
205
- generation: g,
206
- parentId: parent.id,
207
- scenario: child,
208
- score: cscore,
209
- mutationStrategy: mutation.id
210
- });
211
- }
212
- }
213
- }
214
- }
215
- const failures = scenarios.filter((s) => s.score !== null && s.score < failureThreshold).sort((a, b) => (a.score ?? 0) - (b.score ?? 0));
216
- const byGeneration = [];
217
- const maxGen = scenarios.reduce((m, s) => Math.max(m, s.generation), 0);
218
- for (let g = 0; g <= maxGen; g++) {
219
- const gens = scenarios.filter((s) => s.generation === g);
220
- if (gens.length === 0) continue;
221
- const fails = gens.filter((s) => s.score !== null && s.score < failureThreshold).length;
222
- const meanScore = gens.reduce((sum, s) => sum + (s.score ?? 0), 0) / gens.length;
223
- byGeneration.push({ generation: g, total: gens.length, failures: fails, meanScore });
224
- }
225
- return { scenarios, failures, byGeneration, scoreCalls };
226
- }
227
- function mulberry32(seed) {
228
- let s = seed >>> 0;
229
- return () => {
230
- s = s + 1831565813 >>> 0;
231
- let t = s;
232
- t = Math.imul(t ^ t >>> 15, t | 1);
233
- t ^= t + Math.imul(t ^ t >>> 7, t | 61);
234
- return ((t ^ t >>> 14) >>> 0) / 4294967296;
235
- };
236
- }
237
-
238
160
  // src/rl/compute-curves.ts
239
161
  async function runComputeCurve(opts) {
240
162
  const points = [];
@@ -1741,7 +1663,6 @@ export {
1741
1663
  InMemoryOutcomeStore,
1742
1664
  PredictiveValidityResearcher,
1743
1665
  REPRESENTATIVE_MIN_FIDELITY,
1744
- adversarialScenarioSearch,
1745
1666
  appendToCorpus,
1746
1667
  applyEloUpdate,
1747
1668
  bestOfN,