@tangle-network/agent-eval 0.130.1 → 0.131.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.
- package/CHANGELOG.md +12 -0
- package/dist/analyst/index.js +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-BJgDGkAD.js → benchmarks-SRt_Rwuc.js} +3 -3
- package/dist/{benchmarks-BJgDGkAD.js.map → benchmarks-SRt_Rwuc.js.map} +1 -1
- package/dist/campaign/index.js +2 -2
- package/dist/{campaign-aKJt6emI.js → campaign-1WfDhAl4.js} +3 -3
- package/dist/{campaign-aKJt6emI.js.map → campaign-1WfDhAl4.js.map} +1 -1
- package/dist/concurrency-MUjT7VjM.js +109 -0
- package/dist/concurrency-MUjT7VjM.js.map +1 -0
- package/dist/contract/index.d.ts +56 -2
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +293 -47
- package/dist/contract/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/ledger-core/index.js +1 -1
- package/dist/{ledger-core-DtZz1RG0.js → ledger-core-eqaI3PCD.js} +2 -2
- package/dist/{ledger-core-DtZz1RG0.js.map → ledger-core-eqaI3PCD.js.map} +1 -1
- package/dist/openapi.json +1 -1
- package/dist/{semantic-concept-judge-B6cWNJ2K.js → semantic-concept-judge-b5m3irbR.js} +2 -2
- package/dist/{semantic-concept-judge-B6cWNJ2K.js.map → semantic-concept-judge-b5m3irbR.js.map} +1 -1
- package/dist/{skillopt-optimization-method-CUmHkGbI.js → skillopt-optimization-method-Dd6b38Ud.js} +3 -3
- package/dist/{skillopt-optimization-method-CUmHkGbI.js.map → skillopt-optimization-method-Dd6b38Ud.js.map} +1 -1
- package/docs/concepts.md +11 -0
- package/package.json +1 -1
- package/dist/concurrency-DIxRZF_J.js +0 -85
- package/dist/concurrency-DIxRZF_J.js.map +0 -1
package/docs/concepts.md
CHANGED
|
@@ -32,6 +32,17 @@ It contains score distributions, paired lift intervals, judge agreement, cost, f
|
|
|
32
32
|
Run records, scenarios, judge scores, statistics, and release decisions belong here because they work without an agent runtime.
|
|
33
33
|
Agent sessions, worker coordination, sandbox execution, and runtime-specific profiles belong in `agent-runtime`.
|
|
34
34
|
|
|
35
|
+
## Measuring a complete profile
|
|
36
|
+
|
|
37
|
+
Use the profile improvement functions from `/contract` when a host owns immutable agent-profile snapshots.
|
|
38
|
+
`sealAgentProfileImprovementExperiment()` freezes the exact baseline, candidate diff, held-out tasks, model, limits, and policy.
|
|
39
|
+
`runAgentProfileImprovementExperiment()` asks the host to execute every frozen baseline/candidate cell and requires one complete receipt per execution.
|
|
40
|
+
`measuredComparisonFromAgentProfileImprovementExperiment()` recomputes scores, uncertainty, cost, latency, and the release decision from those receipts.
|
|
41
|
+
|
|
42
|
+
This API never activates a candidate or runs an agent itself.
|
|
43
|
+
The host owns authorization, billing, task isolation, profile materialization, execution, and durable evidence.
|
|
44
|
+
The first portable profile contract accepts prompt and skill changes only; a host must add its own exact-state adapter before measuring tools, MCP servers, hooks, subagents, or external knowledge.
|
|
45
|
+
|
|
35
46
|
## Main Objects
|
|
36
47
|
|
|
37
48
|
| Thing | What it is | One-line example |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tangle-network/agent-eval",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.131.0",
|
|
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": {
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
//#region src/concurrency.ts
|
|
2
|
-
/**
|
|
3
|
-
* concurrency — small primitives the evolution loop needs.
|
|
4
|
-
*
|
|
5
|
-
* `Mutex` is a zero-dep async lock with FIFO fairness. The evolution loop
|
|
6
|
-
* uses it to serialise checkout/build/commit sequences inside a single
|
|
7
|
-
* pool slot, and to gate concurrent JSONL writers (see
|
|
8
|
-
* `lockedJsonlReferenceReplayStore`).
|
|
9
|
-
*
|
|
10
|
-
* Deliberately minimal — no priority queue, no timeouts. If you need
|
|
11
|
-
* those, swap to `async-mutex` at the call site.
|
|
12
|
-
*/
|
|
13
|
-
var Mutex = class {
|
|
14
|
-
locked = false;
|
|
15
|
-
waiters = [];
|
|
16
|
-
async acquire() {
|
|
17
|
-
if (!this.locked) {
|
|
18
|
-
this.locked = true;
|
|
19
|
-
return () => this.release();
|
|
20
|
-
}
|
|
21
|
-
return new Promise((resolve) => {
|
|
22
|
-
this.waiters.push(() => {
|
|
23
|
-
resolve(() => this.release());
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
release() {
|
|
28
|
-
const next = this.waiters.shift();
|
|
29
|
-
if (next) next();
|
|
30
|
-
else this.locked = false;
|
|
31
|
-
}
|
|
32
|
-
async runExclusive(fn) {
|
|
33
|
-
const release = await this.acquire();
|
|
34
|
-
try {
|
|
35
|
-
return await fn();
|
|
36
|
-
} finally {
|
|
37
|
-
release();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/** True iff someone holds the lock right now. Diagnostics only. */
|
|
41
|
-
get isLocked() {
|
|
42
|
-
return this.locked;
|
|
43
|
-
}
|
|
44
|
-
/** Pending waiter count. Diagnostics only. */
|
|
45
|
-
get pending() {
|
|
46
|
-
return this.waiters.length;
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Map independent work with a fixed worker count while preserving input order.
|
|
51
|
-
* After the first rejection, no new items start; already-running work is allowed
|
|
52
|
-
* to settle before the returned promise rejects. Partial results are discarded.
|
|
53
|
-
*/
|
|
54
|
-
async function mapConcurrent(items, concurrency, map) {
|
|
55
|
-
if (!Number.isInteger(concurrency) || concurrency < 1) throw new Error(`mapConcurrent: concurrency must be a positive integer, got ${concurrency}`);
|
|
56
|
-
if (items.length === 0) return [];
|
|
57
|
-
const results = new Array(items.length);
|
|
58
|
-
let nextIndex = 0;
|
|
59
|
-
let stopped = false;
|
|
60
|
-
let failed = false;
|
|
61
|
-
let failure;
|
|
62
|
-
const worker = async () => {
|
|
63
|
-
while (!stopped) {
|
|
64
|
-
const index = nextIndex;
|
|
65
|
-
nextIndex += 1;
|
|
66
|
-
if (index >= items.length) return;
|
|
67
|
-
try {
|
|
68
|
-
results[index] = await map(items[index], index);
|
|
69
|
-
} catch (error) {
|
|
70
|
-
stopped = true;
|
|
71
|
-
if (!failed) {
|
|
72
|
-
failed = true;
|
|
73
|
-
failure = error;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, () => worker()));
|
|
79
|
-
if (failed) throw failure;
|
|
80
|
-
return results;
|
|
81
|
-
}
|
|
82
|
-
//#endregion
|
|
83
|
-
export { mapConcurrent as n, Mutex as t };
|
|
84
|
-
|
|
85
|
-
//# sourceMappingURL=concurrency-DIxRZF_J.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concurrency-DIxRZF_J.js","names":[],"sources":["../src/concurrency.ts"],"sourcesContent":["/**\n * concurrency — small primitives the evolution loop needs.\n *\n * `Mutex` is a zero-dep async lock with FIFO fairness. The evolution loop\n * uses it to serialise checkout/build/commit sequences inside a single\n * pool slot, and to gate concurrent JSONL writers (see\n * `lockedJsonlReferenceReplayStore`).\n *\n * Deliberately minimal — no priority queue, no timeouts. If you need\n * those, swap to `async-mutex` at the call site.\n */\n\nexport class Mutex {\n private locked = false\n private readonly waiters: Array<() => void> = []\n\n async acquire(): Promise<() => void> {\n if (!this.locked) {\n this.locked = true\n return () => this.release()\n }\n return new Promise<() => void>((resolve) => {\n this.waiters.push(() => {\n resolve(() => this.release())\n })\n })\n }\n\n private release(): void {\n const next = this.waiters.shift()\n if (next) {\n next()\n } else {\n this.locked = false\n }\n }\n\n async runExclusive<T>(fn: () => Promise<T> | T): Promise<T> {\n const release = await this.acquire()\n try {\n return await fn()\n } finally {\n release()\n }\n }\n\n /** True iff someone holds the lock right now. Diagnostics only. */\n get isLocked(): boolean {\n return this.locked\n }\n\n /** Pending waiter count. Diagnostics only. */\n get pending(): number {\n return this.waiters.length\n }\n}\n\n/**\n * Map independent work with a fixed worker count while preserving input order.\n * After the first rejection, no new items start; already-running work is allowed\n * to settle before the returned promise rejects. Partial results are discarded.\n */\nexport async function mapConcurrent<T, R>(\n items: readonly T[],\n concurrency: number,\n map: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n if (!Number.isInteger(concurrency) || concurrency < 1) {\n throw new Error(`mapConcurrent: concurrency must be a positive integer, got ${concurrency}`)\n }\n if (items.length === 0) return []\n\n const results = new Array<R>(items.length)\n let nextIndex = 0\n let stopped = false\n let failed = false\n let failure: unknown\n\n const worker = async (): Promise<void> => {\n while (!stopped) {\n const index = nextIndex\n nextIndex += 1\n if (index >= items.length) return\n\n try {\n results[index] = await map(items[index]!, index)\n } catch (error) {\n stopped = true\n if (!failed) {\n failed = true\n failure = error\n }\n }\n }\n }\n\n await Promise.all(Array.from({ length: Math.min(concurrency, items.length) }, () => worker()))\n if (failed) throw failure\n return results\n}\n"],"mappings":";;;;;;;;;;;;AAYA,IAAa,QAAb,MAAmB;CACjB,SAAiB;CACjB,UAA8C,CAAC;CAE/C,MAAM,UAA+B;EACnC,IAAI,CAAC,KAAK,QAAQ;GAChB,KAAK,SAAS;GACd,aAAa,KAAK,QAAQ;EAC5B;EACA,OAAO,IAAI,SAAqB,YAAY;GAC1C,KAAK,QAAQ,WAAW;IACtB,cAAc,KAAK,QAAQ,CAAC;GAC9B,CAAC;EACH,CAAC;CACH;CAEA,UAAwB;EACtB,MAAM,OAAO,KAAK,QAAQ,MAAM;EAChC,IAAI,MACF,KAAK;OAEL,KAAK,SAAS;CAElB;CAEA,MAAM,aAAgB,IAAsC;EAC1D,MAAM,U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