@tangle-network/agent-eval 2.0.16 → 2.0.18

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 (37) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/analyst/index.d.ts +20 -2
  3. package/dist/analyst/index.d.ts.map +1 -1
  4. package/dist/analyst/index.js +3 -3
  5. package/dist/app-grade/index.d.ts +1 -1
  6. package/dist/{benchmark-command-DgR1i30h.js → benchmark-command-CZbrh9bS.js} +27 -8
  7. package/dist/benchmark-command-CZbrh9bS.js.map +1 -0
  8. package/dist/benchmarks/index.d.ts +13 -0
  9. package/dist/benchmarks/index.d.ts.map +1 -1
  10. package/dist/benchmarks/index.js +100 -11
  11. package/dist/benchmarks/index.js.map +1 -1
  12. package/dist/cli.js +1 -1
  13. package/dist/dspy-rlm-engine-DFgGrKzg.js +1613 -0
  14. package/dist/dspy-rlm-engine-DFgGrKzg.js.map +1 -0
  15. package/dist/experiment/index.d.ts +74 -5
  16. package/dist/experiment/index.d.ts.map +1 -1
  17. package/dist/experiment/index.js +196 -13
  18. package/dist/experiment/index.js.map +1 -1
  19. package/dist/{findings-store-Drnjid7m.js → findings-store-DcBkRLDk.js} +2 -2
  20. package/dist/{findings-store-Drnjid7m.js.map → findings-store-DcBkRLDk.js.map} +1 -1
  21. package/dist/{index-B8bNGE_2.d.ts → index-4khf0Q7g.d.ts} +236 -2
  22. package/dist/index-4khf0Q7g.d.ts.map +1 -0
  23. package/dist/{index-BkWxigto.d.ts → index-Cq_5SLfF.d.ts} +6 -236
  24. package/dist/index-Cq_5SLfF.d.ts.map +1 -0
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +5 -1087
  27. package/dist/index.js.map +1 -1
  28. package/dist/openapi.json +1 -1
  29. package/dist/wire/index.d.ts +2 -2
  30. package/docs/experiment.md +31 -1
  31. package/docs/trace-contracts.md +23 -0
  32. package/package.json +1 -1
  33. package/dist/benchmark-command-DgR1i30h.js.map +0 -1
  34. package/dist/dspy-rlm-engine-CR5MSL2k.js +0 -463
  35. package/dist/dspy-rlm-engine-CR5MSL2k.js.map +0 -1
  36. package/dist/index-B8bNGE_2.d.ts.map +0 -1
  37. package/dist/index-BkWxigto.d.ts.map +0 -1
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": "2.0.16",
5
+ "version": "2.0.18",
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.1.0. Bumps on breaking changes to request/response schemas.",
7
7
  "contact": {
8
8
  "name": "Tangle Network",
@@ -213,9 +213,9 @@ export declare const FeedbackTrajectorySchema: z.ZodObject<{
213
213
  value: z.ZodUnknown;
214
214
  reason: z.ZodOptional<z.ZodString>;
215
215
  severity: z.ZodOptional<z.ZodEnum<{
216
- error: "error";
217
216
  critical: "critical";
218
217
  info: "info";
218
+ error: "error";
219
219
  warning: "warning";
220
220
  }>>;
221
221
  createdAt: z.ZodString;
@@ -249,9 +249,9 @@ export declare const FeedbackTrajectorySchema: z.ZodObject<{
249
249
  value: z.ZodUnknown;
250
250
  reason: z.ZodOptional<z.ZodString>;
251
251
  severity: z.ZodOptional<z.ZodEnum<{
252
- error: "error";
253
252
  critical: "critical";
254
253
  info: "info";
254
+ error: "error";
255
255
  warning: "warning";
256
256
  }>>;
257
257
  createdAt: z.ZodString;
@@ -56,7 +56,7 @@ An arbitrary verifier that returns success does not establish independent eviden
56
56
  Keep every assigned unit in its original arm, including failed executions.
57
57
  Use outcome `0` only when the registered checker established failure.
58
58
  Use `null` when a checked outcome is unavailable; missing evidence refuses inference.
59
- A missing trace is valid only with an independent no-execution source, zero turns, zero billed cost, and checked failure.
59
+ A missing trace is valid only with an independent no-execution source, zero turns, zero billed cost (or a subscription seat), and checked failure.
60
60
  The library refuses changed served profile, code revision, or checker revision.
61
61
  It also refuses fewer than 40 clusters, fewer than 20 clusters per arm, a dominant cluster, or zero variance.
62
62
 
@@ -114,6 +114,16 @@ const decision = decideRandomizedCanary(
114
114
  if (decision.refusal !== null) throw new Error(decision.refusal)
115
115
  ```
116
116
 
117
+ The assignment unit is a customer, a session or a task.
118
+ A customer is clustered by customer, a session by session or customer, and a task by task or repository.
119
+ A repository cluster, like a customer cluster, holds assignments of both arms, so their covariance stays in one contribution.
120
+
121
+ An assignment run on a subscription seat has a known cost basis and no dollar figure.
122
+ Mark it `billingBasis: 'subscription'` with `billedCostUsd: null` and the seat record as `billingSourceId`.
123
+ It counts as billed coverage, so it never refuses as missing billing, and `coverage.<arm>.subscriptionAssignments` counts it.
124
+ An arm's dollar total stays `null` when any of its assignments is billed to a subscription.
125
+ In `joinProspectiveCanaryReceipts`, the billing row's `settlement: 'subscription'` produces that observation.
126
+
117
127
  `cohortReceipt` binds the post-cutoff complete roster and the fixed observation snapshot to the prospective protocol.
118
128
  `joinProspectiveCanaryReceipts` joins separate assignment, checker, execution, and billing rows before this decision.
119
129
  The join is disabled unless the host explicitly enables it.
@@ -186,6 +196,26 @@ Use the opened handle when the result must follow a particular registration.
186
196
  Direct helpers such as `computeInterval()` and `executeDecisionRule()` also accept unsealed rules for development.
187
197
  They do not establish a link to a registered experiment.
188
198
 
199
+ ### Power for the served canary
200
+
201
+ `clusteredPower` simulates paired contrasts, so it does not describe the canary's unpaired design.
202
+ `randomizedCanaryPower` simulates the canary itself.
203
+ It draws each cluster's success propensity from a Beta distribution with the given control rate and intracluster correlation, randomizes every assignment to an arm, adds the lift to candidate assignments, and runs the decision's own analysis on the result.
204
+ Power is the share of trials where `successCriterionMet` holds, so the cluster floor, the dominant-cluster refusal and the family adjustment all count against it.
205
+ `detectableLift` is the smallest evaluated lift that reaches `targetPower`.
206
+
207
+ ```ts
208
+ import { randomizedCanaryPower } from '@tangle-network/agent-eval/experiment'
209
+
210
+ const power = randomizedCanaryPower({
211
+ clusterSizes: Array.from({ length: 60 }, () => 3),
212
+ controlRate: 0.5,
213
+ intraclusterCorrelation: 0.1,
214
+ lifts: [0, 0.1, 0.2, 0.3],
215
+ seed: 7,
216
+ })
217
+ ```
218
+
189
219
  ### Cluster-aware power refusal
190
220
 
191
221
  `clusteredPower()` combines a cluster-count policy with a simulated power curve:
@@ -110,6 +110,29 @@ A call without captured arguments fails when its tool is called more than once,
110
110
  Grouping matches arguments exactly: a retry that re-encodes a value (`42.5` vs `"42.50"`) is not recognized as the same call.
111
111
  Independent of grouping, a declared write whose call itself errored (including a timeout) and carries no idempotency key always fails — its outcome at the target is unknown, so nothing proves a retry, however it was encoded, would be safe.
112
112
 
113
+ ## Check recorded harness sessions
114
+
115
+ `contractSpansFromHarnessSession` turns a recorded Claude Code or Codex session into the spans a contract reads.
116
+ Each tool call is a `TOOL` span with its arguments as `args` and its input and result text as `input.value` and `output.value`.
117
+ Each assistant message with text is an `LLM` span with that text as `output.value`.
118
+ Calls and messages a fork copied from its parent are left out.
119
+
120
+ The skill-usage readers check each session while they read it: pass `contracts` to `claudeCodeSkillSessions` or `codexSkillSessions`, and each record's `contractChecks` holds, per contract, its status and the violations per rule.
121
+ A rule that matches a command or an answer's text states a procedure, for example that a check's output is never piped into `tail`:
122
+
123
+ ```json
124
+ {
125
+ "name": "procedure",
126
+ "rules": [
127
+ {
128
+ "kind": "never",
129
+ "label": "check-output-piped",
130
+ "p": { "kind": "TOOL", "attr": { "input.value": { "$regex": "run-checks[^|\\n]*\\|\\s*tail", "flags": "" } } }
131
+ }
132
+ ]
133
+ }
134
+ ```
135
+
113
136
  ## Rule semantics
114
137
 
115
138
  Every rule reports `pass`, `fail` or `error` in `ContractVerdict.ruleExecutions`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "description": "Evaluate and improve AI agents from runs, traces, judges, and feedback. Compare candidates, cluster failures, measure lift, and gate releases.",
5
5
  "homepage": "https://github.com/tangle-network/agent-eval#readme",
6
6
  "repository": {