@tangle-network/agent-eval 0.174.0 → 0.176.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 +37 -0
- package/README.md +1 -1
- package/dist/adapters/http.d.ts +1 -1
- package/dist/agent-profile-cell-0gSi5ffD.js +374 -0
- package/dist/agent-profile-cell-0gSi5ffD.js.map +1 -0
- package/dist/analyst/index.d.ts +3 -3
- package/dist/analyst/index.js +4 -4
- package/dist/{benchmark-command-mZIlR-ra.js → benchmark-command-yPqjcZnC.js} +7 -7
- package/dist/{benchmark-command-mZIlR-ra.js.map → benchmark-command-yPqjcZnC.js.map} +1 -1
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +3 -3
- package/dist/campaign/index.d.ts +3 -3
- package/dist/campaign/index.js +9 -9
- package/dist/{campaign-BzMSCejE.js → campaign-85igdlgG.js} +12 -12
- package/dist/{campaign-BzMSCejE.js.map → campaign-85igdlgG.js.map} +1 -1
- package/dist/campaign-evidence-D8DBLqLI.js +2083 -0
- package/dist/campaign-evidence-D8DBLqLI.js.map +1 -0
- package/dist/{opencode-sqlite-eK6HW6dr.js → claude-jsonl-CxZZrDJ3.js} +9 -149
- package/dist/claude-jsonl-CxZZrDJ3.js.map +1 -0
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/dist/contract/index.d.ts +4 -4
- package/dist/contract/index.js +9 -9
- package/dist/{default-registry-CrAp0pYq.js → default-registry-DBqVI4pq.js} +2 -2
- package/dist/{default-registry-CrAp0pYq.js.map → default-registry-DBqVI4pq.js.map} +1 -1
- package/dist/{define-agent-eval-V1jQyCDR.d.ts → define-agent-eval-CCbl8k2E.d.ts} +11 -4
- package/dist/define-agent-eval-CCbl8k2E.d.ts.map +1 -0
- package/dist/{define-agent-eval-ox5McL6e.js → define-agent-eval-DEMsu5eA.js} +54 -36
- package/dist/define-agent-eval-DEMsu5eA.js.map +1 -0
- package/dist/{dspy-rlm-engine-Caz2pl4L.js → dspy-rlm-engine-DqjER2sV.js} +2 -2
- package/dist/{dspy-rlm-engine-Caz2pl4L.js.map → dspy-rlm-engine-DqjER2sV.js.map} +1 -1
- package/dist/{eval-campaign-BeAjdhzC.js → eval-campaign-Cs-7MiCs.js} +4 -5
- package/dist/{eval-campaign-BeAjdhzC.js.map → eval-campaign-Cs-7MiCs.js.map} +1 -1
- package/dist/experiment/index.d.ts +3 -68
- package/dist/experiment/index.d.ts.map +1 -1
- package/dist/experiment/index.js +6 -128
- package/dist/experiment/index.js.map +1 -1
- package/dist/{attestation-XSUpbc4o.js → experiment-tracker-BKEumQug.js} +2 -96
- package/dist/experiment-tracker-BKEumQug.js.map +1 -0
- package/dist/{attestation-c1QvaBdX.d.ts → experiment-tracker-CNwqCZFD.d.ts} +2 -78
- package/dist/experiment-tracker-CNwqCZFD.d.ts.map +1 -0
- package/dist/{external-optimizer-process-CxnFL1hd.js → external-optimizer-process-Dlz8YxrT.js} +3 -3
- package/dist/{external-optimizer-process-CxnFL1hd.js.map → external-optimizer-process-Dlz8YxrT.js.map} +1 -1
- package/dist/{external-optimizer-subprocess-CQi27uEI.js → external-optimizer-subprocess-q3VzlGAO.js} +2 -2
- package/dist/{external-optimizer-subprocess-CQi27uEI.js.map → external-optimizer-subprocess-q3VzlGAO.js.map} +1 -1
- package/dist/{index-Bn-nlnSV.d.ts → index-BAAiSF3_.d.ts} +2 -2
- package/dist/{index-Bn-nlnSV.d.ts.map → index-BAAiSF3_.d.ts.map} +1 -1
- package/dist/{index-DKXuBPXf.d.ts → index-Bg6OT2Dd.d.ts} +23 -10
- package/dist/{index-DKXuBPXf.d.ts.map → index-Bg6OT2Dd.d.ts.map} +1 -1
- package/dist/{index-BTrx5s8m.d.ts → index-DBkcm_9H.d.ts} +4 -4
- package/dist/{index-BTrx5s8m.d.ts.map → index-DBkcm_9H.d.ts.map} +1 -1
- package/dist/{index-D-UdhAmg.d.ts → index-u0d1Jp4F.d.ts} +4 -2
- package/dist/{index-D-UdhAmg.d.ts.map → index-u0d1Jp4F.d.ts.map} +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +15 -16
- package/dist/index.js.map +1 -1
- package/dist/{integrity-BWywb34E.js → integrity-DsHWCebQ.js} +11 -435
- package/dist/integrity-DsHWCebQ.js.map +1 -0
- package/dist/ledger-core/index.d.ts +2 -2
- package/dist/ledger-core/index.js +2 -2
- package/dist/{ledger-core-PIfjCbKn.js → ledger-core-Cs9f7385.js} +60 -47
- package/dist/{ledger-core-PIfjCbKn.js.map → ledger-core-Cs9f7385.js.map} +1 -1
- package/dist/{llm-judge-DmNaBrXB.js → llm-judge-DliimmRb.js} +994 -1517
- package/dist/llm-judge-DliimmRb.js.map +1 -0
- package/dist/{mint-vWOdD8Ae.js → mint-Cc1_zwRQ.js} +2 -2
- package/dist/{mint-vWOdD8Ae.js.map → mint-Cc1_zwRQ.js.map} +1 -1
- package/dist/openapi.json +1 -1
- package/dist/opencode-sqlite-CNw3vubS.js +145 -0
- package/dist/opencode-sqlite-CNw3vubS.js.map +1 -0
- package/dist/{produced-state-B8mw6zj9.js → produced-state-DrMqa2HD.js} +3 -2
- package/dist/{produced-state-B8mw6zj9.js.map → produced-state-DrMqa2HD.js.map} +1 -1
- package/dist/profile-cell.js +1 -268
- package/dist/{promotion-policy-LY9mVQ7W.js → promotion-policy-DWOm70gx.js} +2 -2
- package/dist/{promotion-policy-LY9mVQ7W.js.map → promotion-policy-DWOm70gx.js.map} +1 -1
- package/dist/{release-confidence-BsGEg_xg.js → release-confidence-BcGCclTB.js} +2 -2
- package/dist/{release-confidence-BsGEg_xg.js.map → release-confidence-BcGCclTB.js.map} +1 -1
- package/dist/report-command-DKlXfU5r.js +1528 -0
- package/dist/report-command-DKlXfU5r.js.map +1 -0
- package/dist/reporting.js +2 -2
- package/dist/{reward-hacking-CKW4teig.js → reward-hacking-D0XwhVWE.js} +2 -215
- package/dist/reward-hacking-D0XwhVWE.js.map +1 -0
- package/dist/rl.js +5 -4
- package/dist/rl.js.map +1 -1
- package/dist/rollout/index.js +4 -3
- package/dist/{rollout-C-znbbYg.js → rollout-DmoJVqrF.js} +4 -3
- package/dist/{rollout-C-znbbYg.js.map → rollout-DmoJVqrF.js.map} +1 -1
- package/dist/run-record-CR63CpHK.js +216 -0
- package/dist/run-record-CR63CpHK.js.map +1 -0
- package/dist/{run-record-ZIsR9Fif.js → run-record-DQpSf7t-.js} +2 -2
- package/dist/{run-record-ZIsR9Fif.js.map → run-record-DQpSf7t-.js.map} +1 -1
- package/dist/{semantic-concept-judge-E3s_fEjB.js → semantic-concept-judge-Dw-f7TEs.js} +3 -3
- package/dist/{semantic-concept-judge-E3s_fEjB.js.map → semantic-concept-judge-Dw-f7TEs.js.map} +1 -1
- package/dist/{sequential-B51qAYE4.js → sequential-B5gXgcyp.js} +3 -3
- package/dist/{sequential-B51qAYE4.js.map → sequential-B5gXgcyp.js.map} +1 -1
- package/dist/{skillopt-optimization-method-f7399oGb.js → skillopt-optimization-method-CV7go7ex.js} +6 -749
- package/dist/skillopt-optimization-method-CV7go7ex.js.map +1 -0
- package/dist/{statistical-heldout-Cqb73yE9.d.ts → statistical-heldout-Z9NROFFS.d.ts} +156 -3
- package/dist/statistical-heldout-Z9NROFFS.d.ts.map +1 -0
- package/dist/{summary-report-Bgh8CpNK.js → summary-report-B16xy9Kd.js} +2 -2
- package/dist/{summary-report-Bgh8CpNK.js.map → summary-report-B16xy9Kd.js.map} +1 -1
- package/dist/supervisor-run/index.d.ts +71 -6
- package/dist/supervisor-run/index.d.ts.map +1 -1
- package/dist/supervisor-run/index.js +6 -1357
- package/dist/supervisor-run/index.js.map +1 -1
- package/dist/terminal-record-Ce9_UjRz.js +539 -0
- package/dist/terminal-record-Ce9_UjRz.js.map +1 -0
- package/dist/traces.js +1 -1
- package/dist/{types-CoPUTiXb.d.ts → types-vUdAx2Cj.d.ts} +65 -3
- package/dist/types-vUdAx2Cj.d.ts.map +1 -0
- package/docs/public-api.md +62 -39
- package/docs/search-history-receipts.md +48 -1
- package/package.json +1 -1
- package/dist/attestation-XSUpbc4o.js.map +0 -1
- package/dist/attestation-c1QvaBdX.d.ts.map +0 -1
- package/dist/define-agent-eval-V1jQyCDR.d.ts.map +0 -1
- package/dist/define-agent-eval-ox5McL6e.js.map +0 -1
- package/dist/integrity-BWywb34E.js.map +0 -1
- package/dist/llm-judge-DmNaBrXB.js.map +0 -1
- package/dist/opencode-sqlite-eK6HW6dr.js.map +0 -1
- package/dist/power-preflight-CFXm0Vjo.js +0 -502
- package/dist/power-preflight-CFXm0Vjo.js.map +0 -1
- package/dist/pre-registration-D94b7Of5.js +0 -110
- package/dist/pre-registration-D94b7Of5.js.map +0 -1
- package/dist/profile-cell.js.map +0 -1
- package/dist/reward-hacking-CKW4teig.js.map +0 -1
- package/dist/skillopt-optimization-method-f7399oGb.js.map +0 -1
- package/dist/statistical-heldout-Cqb73yE9.d.ts.map +0 -1
- package/dist/types-CoPUTiXb.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,43 @@ All notable changes to `@tangle-network/agent-eval` and its sibling `agent-eval-
|
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
## [0.176.0] — 2026-09-07
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Complete-method workflows share input preparation, result validation, accounting, and search-history admission.
|
|
12
|
+
`selfImprove({ method })` now accepts the same optional history policy as `compareOptimizationMethods`.
|
|
13
|
+
- `searchHistoryVerification: 'ledger'` verifies referenced bytes and canonical replay through campaign storage before final assessment.
|
|
14
|
+
Coverage reports `ledgerVerified` only after those checks pass.
|
|
15
|
+
- Optional final-measurement `evidence` creates existing evidence receipts from actual baseline and winner campaigns.
|
|
16
|
+
Callers supply evaluator, environment, and authority; Eval derives measured identities without changing selection or promotion.
|
|
17
|
+
- `/experiment` exports `createCampaignEvidenceReceipt`; `/campaign` exports artifact verification and immutable search-ledger replay.
|
|
18
|
+
Ledger text replay reuses the filesystem journal's canonical parser and state machine.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## [0.175.0] — 2026-09-06
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- `agent-eval supervisor-run report <runDir> [--format headline|markdown|json]` prints one run directory's report.
|
|
26
|
+
It exits 1 when the directory cannot be read and 2 on a usage error.
|
|
27
|
+
- `OutcomeMetrics.supStatusSource`, `supReason`, and `failure` name the record a status came from, Runtime's no-winner reason, and the recorded error.
|
|
28
|
+
`readTerminalRecord` is the one derivation the analyzer and the rollout minter share.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- The supervisor-run reader takes a run's status from Runtime's own settle record.
|
|
33
|
+
`result.json` is the `SupervisedResult` that `supervise()` returned, and its `kind` is the status (`runtime-result`).
|
|
34
|
+
The control-plane-era `state.json` `status` and `result.json` `sup_status` remain readable as named legacy sources (`legacy-state`, `legacy-result`).
|
|
35
|
+
- A Runtime `failure.json` without a `result.json` reports status `failed` with the recorded error (`runtime-failure`) instead of an unavailable status.
|
|
36
|
+
A `failure.json` beside a settled result is reported with `earlierAttempt: true`; the settled result stays the status.
|
|
37
|
+
- A directory holding `observer.jsonl` or `failure.json` is a Runtime run directory before its spawn journal exists.
|
|
38
|
+
`isRuntimeSupervisorRunDir`, `analyzeSupervisorRun`, and `findSupervisorRunDirs` recognize it, and every journal metric stays a named absence.
|
|
39
|
+
- The Runtime reader no longer copies the result status onto its begin-stamp state document; `SupervisorRunSources.state` for a Runtime run carries `id` and `startedAt` only.
|
|
40
|
+
It no longer reads `trajectory.json`, which Runtime never wrote.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
7
44
|
## [0.174.0] — 2026-09-05
|
|
8
45
|
|
|
9
46
|
### Changed
|
package/README.md
CHANGED
|
@@ -163,7 +163,7 @@ and [DSPy](./docs/campaign-proposers.md#use-official-dspy-optimizers).
|
|
|
163
163
|
| `@tangle-network/agent-eval/trajectory-replay` | Re-execute a recorded shell trajectory and check whether its failure reproduces. |
|
|
164
164
|
| `@tangle-network/agent-eval/traces` | Store, replay, and inspect structured traces. |
|
|
165
165
|
| `@tangle-network/agent-eval/reporting` | Statistical comparisons and report rendering. |
|
|
166
|
-
| `@tangle-network/agent-eval/supervisor-run` | Read recursive run directories without collapsing missing measurements to zero. |
|
|
166
|
+
| `@tangle-network/agent-eval/supervisor-run` | Read recursive run directories without collapsing missing measurements to zero; `agent-eval supervisor-run report <runDir>` prints one. |
|
|
167
167
|
| `@tangle-network/agent-eval/meta-eval` | Measure the grader itself: judge calibration, sentinels, and seeded known-wrong plants. |
|
|
168
168
|
| `@tangle-network/agent-eval/profile-cell` | Create and validate portable agent-profile identities. |
|
|
169
169
|
| `@tangle-network/agent-eval/ledger-core` | Append-only hash-chained journal with idempotent append and chain verification. |
|
package/dist/adapters/http.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { R as Scenario, d as DispatchContext, f as DispatchFn } from "../types-BJz2CPTM.js";
|
|
2
|
-
import "../index-
|
|
2
|
+
import "../index-DBkcm_9H.js";
|
|
3
3
|
//#region src/adapters/http.d.ts
|
|
4
4
|
interface HttpDispatchOptions<TScenario extends Scenario, _TArtifact> {
|
|
5
5
|
/** Static endpoint URL. Mutually exclusive with `resolveUrl`. */
|
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { s as ValidationError } from "./errors-Dngq5h35.js";
|
|
2
|
+
import { a as hashCanonical, r as canonicalString } from "./canonical-DPyQ_rpt.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
//#region src/pre-registration.ts
|
|
5
|
+
/**
|
|
6
|
+
* Pre-registered hypotheses — declare what you're testing BEFORE the
|
|
7
|
+
* run, check it AFTER. Prevents p-hacking, optional stopping, and the
|
|
8
|
+
* "we ran until it looked good" failure mode.
|
|
9
|
+
*
|
|
10
|
+
* Manifest is a plain JSON-friendly object. Sign it with a content hash
|
|
11
|
+
* + timestamp; the registered record becomes immutable. Post-run,
|
|
12
|
+
* evaluate the manifest against observed results — the library refuses
|
|
13
|
+
* to let you re-interpret a different metric as the declared one.
|
|
14
|
+
*
|
|
15
|
+
* A signed manifest is a portable record: it is written once and verified
|
|
16
|
+
* later, possibly by a different release. `algo` names the digest scheme it
|
|
17
|
+
* was signed under, and verification selects the encoder by that field, so a
|
|
18
|
+
* manifest signed by an earlier release still verifies.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* SHA-256 hex (full 64 chars) over the RFC 8785 canonical JSON encoding of
|
|
22
|
+
* `obj` — the package's one identity scheme, shared with `ledger-core`.
|
|
23
|
+
*
|
|
24
|
+
* Values canonical JSON cannot represent faithfully — `undefined`, `NaN`,
|
|
25
|
+
* class instances, cycles — are refused rather than coerced, because a
|
|
26
|
+
* coercion maps two distinct records onto one digest.
|
|
27
|
+
*
|
|
28
|
+
* Named `hashJson` to disambiguate from `prompt-registry.ts`'s `hashContent`,
|
|
29
|
+
* which takes a string input and returns a truncated 12-char prompt id.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const hash = await hashJson({ id: '1', kind: 'spec' })
|
|
33
|
+
* // 'a3f1...' (64 hex chars)
|
|
34
|
+
*/
|
|
35
|
+
async function hashJson(obj) {
|
|
36
|
+
return hashCanonical(obj).slice(7);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Key-sorted `JSON.stringify` digest. Private and read-only: it exists so a
|
|
40
|
+
* manifest signed under `'sha256-content'` still verifies, and nothing that
|
|
41
|
+
* WRITES a digest may call it.
|
|
42
|
+
*/
|
|
43
|
+
function legacyContentDigest(value) {
|
|
44
|
+
return createHash("sha256").update(JSON.stringify(sortKeysDeep$1(value)), "utf8").digest("hex");
|
|
45
|
+
}
|
|
46
|
+
function sortKeysDeep$1(value) {
|
|
47
|
+
if (value === null || typeof value !== "object") return value;
|
|
48
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep$1);
|
|
49
|
+
const out = {};
|
|
50
|
+
for (const key of Object.keys(value).sort()) out[key] = sortKeysDeep$1(value[key]);
|
|
51
|
+
return out;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Digest of a manifest under its own declared scheme, with `contentHash` and
|
|
55
|
+
* `algo` stripped. Synchronous, so a caller that must fail before consuming an
|
|
56
|
+
* observation does not have to await. Throws on an `algo` this release does
|
|
57
|
+
* not know — an unverifiable manifest must not read as a valid one.
|
|
58
|
+
*/
|
|
59
|
+
function manifestContentDigest(manifest) {
|
|
60
|
+
const { contentHash: _contentHash, algo, ...rest } = manifest;
|
|
61
|
+
if (algo === void 0 || algo === "sha256-content") return legacyContentDigest(rest);
|
|
62
|
+
if (algo === "sha256-rfc8785") return createHash("sha256").update(canonicalString(rest), "utf8").digest("hex");
|
|
63
|
+
throw new Error(`pre-registration: unrecognized manifest hash algo '${String(algo)}'`);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Sign a manifest with a SHA-256 content hash over its RFC 8785 canonical
|
|
67
|
+
* JSON, with `contentHash` and `algo` stripped, and stamp the scheme in
|
|
68
|
+
* `algo` so a later reader knows which encoder to verify with.
|
|
69
|
+
*/
|
|
70
|
+
async function signManifest(m) {
|
|
71
|
+
const signed = {
|
|
72
|
+
...m,
|
|
73
|
+
contentHash: "",
|
|
74
|
+
algo: "sha256-rfc8785"
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
...signed,
|
|
78
|
+
contentHash: manifestContentDigest(signed)
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Verify that a signed manifest has not been tampered with, under the scheme
|
|
83
|
+
* the manifest itself declares.
|
|
84
|
+
*/
|
|
85
|
+
async function verifyManifest(m) {
|
|
86
|
+
return manifestContentDigest(m) === m.contentHash;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Evaluate a pre-registered hypothesis against observed results.
|
|
90
|
+
* Mechanical — no re-interpretation permitted.
|
|
91
|
+
*/
|
|
92
|
+
async function evaluateHypothesis(manifest, observed) {
|
|
93
|
+
if (!await verifyManifest(manifest)) throw new Error("evaluateHypothesis: manifest content hash mismatch (tampered)");
|
|
94
|
+
const reasons = [];
|
|
95
|
+
if (!(manifest.direction === "increase" ? observed.effect > 0 : observed.effect < 0)) reasons.push("wrong_direction");
|
|
96
|
+
if (Math.abs(observed.effect) < manifest.minEffect) reasons.push("effect_too_small");
|
|
97
|
+
if (observed.pValue >= manifest.alpha) reasons.push("not_significant");
|
|
98
|
+
if (observed.n < manifest.preRegisteredN) reasons.push("undersampled");
|
|
99
|
+
return {
|
|
100
|
+
manifest,
|
|
101
|
+
observedN: observed.n,
|
|
102
|
+
observedEffect: observed.effect,
|
|
103
|
+
observedPValue: observed.pValue,
|
|
104
|
+
confirmed: reasons.length === 0,
|
|
105
|
+
rejectionReasons: reasons
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/agent-profile-cell.ts
|
|
110
|
+
var AgentProfileCellValidationError = class extends ValidationError {
|
|
111
|
+
path;
|
|
112
|
+
constructor(message, path = "") {
|
|
113
|
+
super(path ? `${message} (at ${path})` : message);
|
|
114
|
+
this.path = path;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const SHA256_HEX = /^[0-9a-f]{64}$/;
|
|
118
|
+
/**
|
|
119
|
+
* A cell id names the digest scheme that produced it. `sha256-rfc8785` is what
|
|
120
|
+
* {@link buildAgentProfileCell} mints; the bare `sha256` form is read-only,
|
|
121
|
+
* carried by cells built under an earlier release, and still verifies.
|
|
122
|
+
*/
|
|
123
|
+
const CELL_ID = /^agent-profile-cell:sha256(?:-rfc8785)?:[0-9a-f]{64}$/;
|
|
124
|
+
const CELL_ID_PREFIX = "agent-profile-cell:sha256-rfc8785:";
|
|
125
|
+
const LEGACY_CELL_ID_PREFIX = "agent-profile-cell:sha256:";
|
|
126
|
+
async function buildAgentProfileCell(input) {
|
|
127
|
+
const material = await normalizeAgentProfileCellInput(input);
|
|
128
|
+
const cellId = `${CELL_ID_PREFIX}${await hashJson(material)}`;
|
|
129
|
+
return {
|
|
130
|
+
...material,
|
|
131
|
+
cellId
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function agentProfileCellHashMaterial(cell) {
|
|
135
|
+
const { cellId: _cellId, ...material } = cell;
|
|
136
|
+
return normalizeAgentProfileCell(material);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Verify an `AgentProfileCell`'s `cellId` matches the sha256 of its hash-material
|
|
140
|
+
* fields, confirming the record has not been tampered with. The id names its own
|
|
141
|
+
* digest scheme, so a cell minted by an earlier release verifies under that scheme.
|
|
142
|
+
*/
|
|
143
|
+
async function verifyAgentProfileCell(cell) {
|
|
144
|
+
validateAgentProfileCell(cell);
|
|
145
|
+
const material = agentProfileCellHashMaterial(cell);
|
|
146
|
+
if (cell.cellId.startsWith(CELL_ID_PREFIX)) return cell.cellId === `${CELL_ID_PREFIX}${await hashJson(material)}`;
|
|
147
|
+
return cell.cellId === `${LEGACY_CELL_ID_PREFIX}${legacyCellDigest(material)}`;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Key-sorted `JSON.stringify` digest. Private and read-only: it verifies a cell
|
|
151
|
+
* id minted before the RFC 8785 scheme, and no path that MINTS an id calls it.
|
|
152
|
+
*/
|
|
153
|
+
function legacyCellDigest(value) {
|
|
154
|
+
return createHash("sha256").update(JSON.stringify(sortKeysDeep(value)), "utf8").digest("hex");
|
|
155
|
+
}
|
|
156
|
+
function sortKeysDeep(value) {
|
|
157
|
+
if (value === null || typeof value !== "object") return value;
|
|
158
|
+
if (Array.isArray(value)) return value.map(sortKeysDeep);
|
|
159
|
+
const out = {};
|
|
160
|
+
for (const key of Object.keys(value).sort()) out[key] = sortKeysDeep(value[key]);
|
|
161
|
+
return out;
|
|
162
|
+
}
|
|
163
|
+
function validateAgentProfileCell(input) {
|
|
164
|
+
if (input === null || typeof input !== "object") throw new AgentProfileCellValidationError("expected object");
|
|
165
|
+
const obj = input;
|
|
166
|
+
expectLiteral(obj.schemaVersion, "agent-profile-cell/v1", "schemaVersion");
|
|
167
|
+
if (typeof obj.cellId !== "string" || !CELL_ID.test(obj.cellId)) throw new AgentProfileCellValidationError("cellId must match agent-profile-cell:sha256:<64 lowercase hex chars>", "cellId");
|
|
168
|
+
expectString(obj.profileId, "profileId");
|
|
169
|
+
validateSource(obj.sourceProfile, "sourceProfile");
|
|
170
|
+
if (obj.harness !== void 0) validateHarness(obj.harness, "harness");
|
|
171
|
+
if (obj.model !== void 0) expectString(obj.model, "model");
|
|
172
|
+
if (obj.promptHash !== void 0) expectString(obj.promptHash, "promptHash");
|
|
173
|
+
if (obj.dimensions !== void 0) validateDimensions(obj.dimensions, "dimensions");
|
|
174
|
+
return input;
|
|
175
|
+
}
|
|
176
|
+
function requireAgentProfileCell(record) {
|
|
177
|
+
if (!record.agentProfile) throw new AgentProfileCellValidationError(`run "${record.runId}" is missing agentProfile; profile-cell grouping requires explicit profile identity`, "agentProfile");
|
|
178
|
+
return validateAgentProfileCell(record.agentProfile);
|
|
179
|
+
}
|
|
180
|
+
function agentProfileCellKey(record) {
|
|
181
|
+
return requireAgentProfileCell(record).cellId;
|
|
182
|
+
}
|
|
183
|
+
async function assertRunAgentProfileCell(record) {
|
|
184
|
+
const profile = requireAgentProfileCell(record);
|
|
185
|
+
if (!await verifyAgentProfileCell(profile)) throw new AgentProfileCellValidationError(`run "${record.runId}" has an agentProfile.cellId that does not match its content`, "agentProfile.cellId");
|
|
186
|
+
if (profile.model !== void 0 && profile.model !== record.model) throw new AgentProfileCellValidationError(`run "${record.runId}" agentProfile.model "${profile.model}" does not match model "${record.model}"`, "agentProfile.model");
|
|
187
|
+
if (profile.promptHash !== void 0 && profile.promptHash !== record.promptHash) throw new AgentProfileCellValidationError(`run "${record.runId}" agentProfile.promptHash "${profile.promptHash}" does not match promptHash "${record.promptHash}"`, "agentProfile.promptHash");
|
|
188
|
+
return profile;
|
|
189
|
+
}
|
|
190
|
+
function groupRunsByAgentProfileCell(records) {
|
|
191
|
+
const groups = /* @__PURE__ */ new Map();
|
|
192
|
+
for (const record of records) {
|
|
193
|
+
const key = agentProfileCellKey(record);
|
|
194
|
+
const bucket = groups.get(key);
|
|
195
|
+
if (bucket) bucket.push(record);
|
|
196
|
+
else groups.set(key, [record]);
|
|
197
|
+
}
|
|
198
|
+
return groups;
|
|
199
|
+
}
|
|
200
|
+
async function normalizeAgentProfileCellInput(input) {
|
|
201
|
+
return normalizeAgentProfileCell({
|
|
202
|
+
schemaVersion: "agent-profile-cell/v1",
|
|
203
|
+
profileId: input.profileId,
|
|
204
|
+
sourceProfile: await normalizeSourceInput(input.sourceProfile),
|
|
205
|
+
harness: input.harness,
|
|
206
|
+
model: input.model,
|
|
207
|
+
promptHash: input.promptHash,
|
|
208
|
+
dimensions: input.dimensions
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function normalizeAgentProfileCell(input) {
|
|
212
|
+
return compactObject({
|
|
213
|
+
schemaVersion: "agent-profile-cell/v1",
|
|
214
|
+
profileId: requireNonEmpty(input.profileId, "profileId"),
|
|
215
|
+
sourceProfile: normalizeSource(input.sourceProfile),
|
|
216
|
+
harness: input.harness ? normalizeHarness(input.harness, "harness") : void 0,
|
|
217
|
+
model: optionalNonEmpty(input.model, "model"),
|
|
218
|
+
promptHash: optionalNonEmpty(input.promptHash, "promptHash"),
|
|
219
|
+
dimensions: input.dimensions ? nonEmptyRecord(normalizeDimensions(input.dimensions)) : void 0
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
async function normalizeSourceInput(input) {
|
|
223
|
+
const kind = requireNonEmpty(input.kind, "sourceProfile.kind");
|
|
224
|
+
if (input.hash !== void 0 && input.profile !== void 0) throw new AgentProfileCellValidationError("sourceProfile must provide either hash or profile, not both", "sourceProfile");
|
|
225
|
+
if (input.hash !== void 0) return {
|
|
226
|
+
kind,
|
|
227
|
+
hash: requireSha256Hex(input.hash, "sourceProfile.hash")
|
|
228
|
+
};
|
|
229
|
+
if (input.profile === void 0) throw new AgentProfileCellValidationError("sourceProfile must provide hash or profile", "sourceProfile");
|
|
230
|
+
assertJson(input.profile, "sourceProfile.profile");
|
|
231
|
+
return {
|
|
232
|
+
kind,
|
|
233
|
+
hash: await hashJson(input.profile)
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
function normalizeSource(input) {
|
|
237
|
+
return {
|
|
238
|
+
kind: requireNonEmpty(input.kind, "sourceProfile.kind"),
|
|
239
|
+
hash: requireSha256Hex(input.hash, "sourceProfile.hash")
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
function normalizeHarness(input, path) {
|
|
243
|
+
return compactObject({
|
|
244
|
+
id: requireNonEmpty(input.id, `${path}.id`),
|
|
245
|
+
version: optionalNonEmpty(input.version, `${path}.version`),
|
|
246
|
+
hash: optionalNonEmpty(input.hash, `${path}.hash`)
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
function normalizeDimensions(input) {
|
|
250
|
+
const out = {};
|
|
251
|
+
for (const key of Object.keys(input).sort()) {
|
|
252
|
+
const value = input[key];
|
|
253
|
+
requireNonEmpty(key, "dimensions.<key>");
|
|
254
|
+
if (value !== null && typeof value !== "string" && typeof value !== "number" && typeof value !== "boolean") throw new AgentProfileCellValidationError("expected primitive dimension value", `dimensions.${key}`);
|
|
255
|
+
if (typeof value === "number" && !Number.isFinite(value)) throw new AgentProfileCellValidationError("expected finite number", `dimensions.${key}`);
|
|
256
|
+
out[key] = value;
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
function compactObject(input) {
|
|
261
|
+
const out = {};
|
|
262
|
+
for (const [key, value] of Object.entries(input)) if (value !== void 0) out[key] = value;
|
|
263
|
+
return out;
|
|
264
|
+
}
|
|
265
|
+
function nonEmptyRecord(input) {
|
|
266
|
+
return Object.keys(input).length > 0 ? input : void 0;
|
|
267
|
+
}
|
|
268
|
+
function validateSource(value, path) {
|
|
269
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new AgentProfileCellValidationError("expected object", path);
|
|
270
|
+
const rec = value;
|
|
271
|
+
expectString(rec.kind, `${path}.kind`);
|
|
272
|
+
requireSha256Hex(rec.hash, `${path}.hash`);
|
|
273
|
+
}
|
|
274
|
+
function validateHarness(value, path) {
|
|
275
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new AgentProfileCellValidationError("expected object", path);
|
|
276
|
+
const rec = value;
|
|
277
|
+
expectString(rec.id, `${path}.id`);
|
|
278
|
+
if (rec.version !== void 0) expectString(rec.version, `${path}.version`);
|
|
279
|
+
if (rec.hash !== void 0) expectString(rec.hash, `${path}.hash`);
|
|
280
|
+
}
|
|
281
|
+
function validateDimensions(value, path) {
|
|
282
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) throw new AgentProfileCellValidationError("expected object", path);
|
|
283
|
+
normalizeDimensions(value);
|
|
284
|
+
}
|
|
285
|
+
function assertJson(value, path) {
|
|
286
|
+
if (value === null) return;
|
|
287
|
+
const type = typeof value;
|
|
288
|
+
if (type === "string" || type === "boolean") return;
|
|
289
|
+
if (type === "number") {
|
|
290
|
+
if (!Number.isFinite(value)) throw new AgentProfileCellValidationError("expected finite number", path);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (Array.isArray(value)) {
|
|
294
|
+
value.forEach((item, index) => {
|
|
295
|
+
assertJson(item, `${path}[${index}]`);
|
|
296
|
+
});
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
if (type === "object") {
|
|
300
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
301
|
+
requireNonEmpty(key, `${path}.<key>`);
|
|
302
|
+
assertJson(nested, `${path}.${key}`);
|
|
303
|
+
}
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
throw new AgentProfileCellValidationError("expected JSON-compatible value", path);
|
|
307
|
+
}
|
|
308
|
+
function expectLiteral(value, expected, path) {
|
|
309
|
+
if (value !== expected) throw new AgentProfileCellValidationError(`expected ${expected}`, path);
|
|
310
|
+
}
|
|
311
|
+
function expectString(value, path) {
|
|
312
|
+
if (typeof value !== "string" || value.length === 0) throw new AgentProfileCellValidationError("expected non-empty string", path);
|
|
313
|
+
}
|
|
314
|
+
function requireNonEmpty(value, path) {
|
|
315
|
+
if (typeof value !== "string" || value.length === 0) throw new AgentProfileCellValidationError("expected non-empty string", path);
|
|
316
|
+
return value;
|
|
317
|
+
}
|
|
318
|
+
function optionalNonEmpty(value, path) {
|
|
319
|
+
if (value === void 0) return void 0;
|
|
320
|
+
return requireNonEmpty(value, path);
|
|
321
|
+
}
|
|
322
|
+
function requireSha256Hex(value, path) {
|
|
323
|
+
if (typeof value !== "string" || !SHA256_HEX.test(value)) throw new AgentProfileCellValidationError("expected 64 lowercase sha256 hex chars", path);
|
|
324
|
+
return value;
|
|
325
|
+
}
|
|
326
|
+
/** Canonical `sourceProfile.kind` values. Two products fingerprinting the
|
|
327
|
+
* same canonical profile MUST use the same kind for their cells to share
|
|
328
|
+
* `sourceProfile.hash`. Extend rather than create new strings — adding a
|
|
329
|
+
* new kind is a deliberate cross-product schema change. */
|
|
330
|
+
const AGENT_PROFILE_KINDS = {
|
|
331
|
+
/** A profile declared via `defineAgentProfile(...)` from
|
|
332
|
+
* `@tangle-network/agent-interface`. The default kind for router-backed
|
|
333
|
+
* and sandbox-backed products. */
|
|
334
|
+
AGENT_INTERFACE_PROFILE: "agent-interface-profile" };
|
|
335
|
+
/** Canonicalize an arbitrary value into `AgentProfileJson` by JSON
|
|
336
|
+
* round-trip. Throws when the value contains anything not representable
|
|
337
|
+
* as JSON (functions, BigInt, cycles) — non-portable profiles fail loud
|
|
338
|
+
* rather than silently dropping fields. */
|
|
339
|
+
function toAgentProfileJson(value) {
|
|
340
|
+
let serialized;
|
|
341
|
+
try {
|
|
342
|
+
serialized = JSON.stringify(value);
|
|
343
|
+
} catch (err) {
|
|
344
|
+
throw new AgentProfileCellValidationError(`agent profile must be JSON-serializable: ${err instanceof Error ? err.message : String(err)}`, "sourceProfile.profile");
|
|
345
|
+
}
|
|
346
|
+
if (serialized === void 0) throw new AgentProfileCellValidationError("agent profile must be JSON-serializable (got undefined after JSON.stringify)", "sourceProfile.profile");
|
|
347
|
+
return JSON.parse(serialized);
|
|
348
|
+
}
|
|
349
|
+
/** Higher-level helper that hard-codes the canonical
|
|
350
|
+
* `agent-interface-profile` kind plus the JSON canonicalization. Equivalent
|
|
351
|
+
* to calling `buildAgentProfileCell` with `profileId = \`${name}@${version}\``
|
|
352
|
+
* and `sourceProfile = { kind: AGENT_INTERFACE_PROFILE, profile: <round-tripped> }`.
|
|
353
|
+
*
|
|
354
|
+
* Use this from any product consuming an agent-interface `AgentProfile`; the
|
|
355
|
+
* manual `buildAgentProfileCell` call is reserved for advanced cases
|
|
356
|
+
* (custom kinds, pre-computed source hashes, alternate profileId
|
|
357
|
+
* conventions). */
|
|
358
|
+
async function buildAgentInterfaceProfileCell(profile, input) {
|
|
359
|
+
if (!profile || typeof profile !== "object") throw new AgentProfileCellValidationError("AgentProfile must be an object", "profile");
|
|
360
|
+
if (typeof profile.name !== "string" || profile.name.length === 0) throw new AgentProfileCellValidationError("AgentProfile must have a non-empty `name`", "profile.name");
|
|
361
|
+
if (typeof profile.version !== "string" || profile.version.length === 0) throw new AgentProfileCellValidationError("AgentProfile must have a non-empty `version`", "profile.version");
|
|
362
|
+
return buildAgentProfileCell({
|
|
363
|
+
...input,
|
|
364
|
+
profileId: `${profile.name}@${profile.version}`,
|
|
365
|
+
sourceProfile: {
|
|
366
|
+
kind: AGENT_PROFILE_KINDS.AGENT_INTERFACE_PROFILE,
|
|
367
|
+
profile: toAgentProfileJson(profile)
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
//#endregion
|
|
372
|
+
export { verifyManifest as _, assertRunAgentProfileCell as a, groupRunsByAgentProfileCell as c, validateAgentProfileCell as d, verifyAgentProfileCell as f, signManifest as g, manifestContentDigest as h, agentProfileCellKey as i, requireAgentProfileCell as l, hashJson as m, AgentProfileCellValidationError as n, buildAgentInterfaceProfileCell as o, evaluateHypothesis as p, agentProfileCellHashMaterial as r, buildAgentProfileCell as s, AGENT_PROFILE_KINDS as t, toAgentProfileJson as u };
|
|
373
|
+
|
|
374
|
+
//# sourceMappingURL=agent-profile-cell-0gSi5ffD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-profile-cell-0gSi5ffD.js","names":["sortKeysDeep"],"sources":["../src/pre-registration.ts","../src/agent-profile-cell.ts"],"sourcesContent":["/**\n * Pre-registered hypotheses — declare what you're testing BEFORE the\n * run, check it AFTER. Prevents p-hacking, optional stopping, and the\n * \"we ran until it looked good\" failure mode.\n *\n * Manifest is a plain JSON-friendly object. Sign it with a content hash\n * + timestamp; the registered record becomes immutable. Post-run,\n * evaluate the manifest against observed results — the library refuses\n * to let you re-interpret a different metric as the declared one.\n *\n * A signed manifest is a portable record: it is written once and verified\n * later, possibly by a different release. `algo` names the digest scheme it\n * was signed under, and verification selects the encoder by that field, so a\n * manifest signed by an earlier release still verifies.\n */\n\nimport { createHash } from 'node:crypto'\nimport { canonicalString, hashCanonical } from './ledger-core/canonical'\n\nexport interface HypothesisManifest {\n id: string\n /** Human prose — goes into the audit trail. */\n hypothesis: string\n /** Metric the hypothesis claims to move. */\n metric: string\n /** 'increase' = candidate should score higher than baseline; 'decrease' = lower. */\n direction: 'increase' | 'decrease'\n /** Minimum effect size to count (same units as the metric). */\n minEffect: number\n /** Alpha threshold. */\n alpha: number\n /** Target statistical power at which sample size was pre-computed. */\n power: number\n /** Declared N per arm before running. */\n preRegisteredN: number\n /** ISO8601 timestamp the manifest was registered. */\n registeredAt: string\n /** Optional identifiers to tie into the trace corpus. */\n baselineLabel?: string\n candidateLabel?: string\n}\n\n/**\n * Identifier for the hashing scheme used to produce `contentHash`.\n *\n * Both schemes are sha256 hex over the manifest with `contentHash` and `algo`\n * stripped, and differ only in how that manifest is serialized:\n *\n * - `'sha256-rfc8785'` — RFC 8785 canonical JSON. What {@link signManifest}\n * emits.\n * - `'sha256-content'` — key-sorted `JSON.stringify`. Read-only: manifests\n * signed by an earlier release carry it, or carry no `algo` at all, and\n * {@link verifyManifest} still verifies them.\n */\nexport type SignedManifestAlgo = 'sha256-content' | 'sha256-rfc8785'\n\nexport interface SignedManifest extends HypothesisManifest {\n /** sha256 hex of canonicalized manifest (everything except contentHash and algo). */\n contentHash: string\n /**\n * Algorithm string describing how `contentHash` was produced.\n *\n * Optional on the type so serialized manifests without it still parse,\n * but ALWAYS populated by {@link signManifest}. Consumers that want to\n * enforce a known algorithm should reject manifests where this field\n * is missing or unrecognized.\n */\n algo?: SignedManifestAlgo\n}\n\nexport interface HypothesisResult {\n manifest: SignedManifest\n observedN: number\n observedEffect: number\n observedPValue: number\n /** True iff the observed effect hits the pre-declared direction with\n * magnitude ≥ minEffect AND p < alpha. */\n confirmed: boolean\n /** Enumerated reasons the hypothesis was rejected (each a machine-tag). */\n rejectionReasons: Array<\n 'wrong_direction' | 'effect_too_small' | 'not_significant' | 'undersampled'\n >\n notes?: string\n}\n\n/**\n * SHA-256 hex (full 64 chars) over the RFC 8785 canonical JSON encoding of\n * `obj` — the package's one identity scheme, shared with `ledger-core`.\n *\n * Values canonical JSON cannot represent faithfully — `undefined`, `NaN`,\n * class instances, cycles — are refused rather than coerced, because a\n * coercion maps two distinct records onto one digest.\n *\n * Named `hashJson` to disambiguate from `prompt-registry.ts`'s `hashContent`,\n * which takes a string input and returns a truncated 12-char prompt id.\n *\n * @example\n * const hash = await hashJson({ id: '1', kind: 'spec' })\n * // 'a3f1...' (64 hex chars)\n */\nexport async function hashJson<T>(obj: T): Promise<string> {\n return hashCanonical(obj).slice('sha256:'.length)\n}\n\n/**\n * Key-sorted `JSON.stringify` digest. Private and read-only: it exists so a\n * manifest signed under `'sha256-content'` still verifies, and nothing that\n * WRITES a digest may call it.\n */\nfunction legacyContentDigest(value: unknown): string {\n return createHash('sha256')\n .update(JSON.stringify(sortKeysDeep(value)), 'utf8')\n .digest('hex')\n}\n\nfunction sortKeysDeep(value: unknown): unknown {\n if (value === null || typeof value !== 'object') return value\n if (Array.isArray(value)) return value.map(sortKeysDeep)\n const out: Record<string, unknown> = {}\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n out[key] = sortKeysDeep((value as Record<string, unknown>)[key])\n }\n return out\n}\n\n/**\n * Digest of a manifest under its own declared scheme, with `contentHash` and\n * `algo` stripped. Synchronous, so a caller that must fail before consuming an\n * observation does not have to await. Throws on an `algo` this release does\n * not know — an unverifiable manifest must not read as a valid one.\n */\nexport function manifestContentDigest(manifest: SignedManifest): string {\n const { contentHash: _contentHash, algo, ...rest } = manifest\n void _contentHash\n if (algo === undefined || algo === 'sha256-content') return legacyContentDigest(rest)\n if (algo === 'sha256-rfc8785') {\n return createHash('sha256').update(canonicalString(rest), 'utf8').digest('hex')\n }\n throw new Error(`pre-registration: unrecognized manifest hash algo '${String(algo)}'`)\n}\n\n/**\n * Sign a manifest with a SHA-256 content hash over its RFC 8785 canonical\n * JSON, with `contentHash` and `algo` stripped, and stamp the scheme in\n * `algo` so a later reader knows which encoder to verify with.\n */\nexport async function signManifest(m: HypothesisManifest): Promise<SignedManifest> {\n const signed: SignedManifest = { ...m, contentHash: '', algo: 'sha256-rfc8785' }\n return { ...signed, contentHash: manifestContentDigest(signed) }\n}\n\n/**\n * Verify that a signed manifest has not been tampered with, under the scheme\n * the manifest itself declares.\n */\nexport async function verifyManifest(m: SignedManifest): Promise<boolean> {\n return manifestContentDigest(m) === m.contentHash\n}\n\n/**\n * Evaluate a pre-registered hypothesis against observed results.\n * Mechanical — no re-interpretation permitted.\n */\nexport async function evaluateHypothesis(\n manifest: SignedManifest,\n observed: { n: number; effect: number; pValue: number },\n): Promise<HypothesisResult> {\n if (!(await verifyManifest(manifest))) {\n throw new Error('evaluateHypothesis: manifest content hash mismatch (tampered)')\n }\n const reasons: HypothesisResult['rejectionReasons'] = []\n const directionOk = manifest.direction === 'increase' ? observed.effect > 0 : observed.effect < 0\n if (!directionOk) reasons.push('wrong_direction')\n if (Math.abs(observed.effect) < manifest.minEffect) reasons.push('effect_too_small')\n if (observed.pValue >= manifest.alpha) reasons.push('not_significant')\n if (observed.n < manifest.preRegisteredN) reasons.push('undersampled')\n return {\n manifest,\n observedN: observed.n,\n observedEffect: observed.effect,\n observedPValue: observed.pValue,\n confirmed: reasons.length === 0,\n rejectionReasons: reasons,\n }\n}\n","import { createHash } from 'node:crypto'\nimport type { AgentProfile } from '@tangle-network/agent-interface'\nimport { ValidationError } from './errors'\nimport { hashJson } from './pre-registration'\n\nexport type AgentProfileCellSchemaVersion = 'agent-profile-cell/v1'\n\nexport type AgentProfileJsonObject = { [key: string]: AgentProfileJson }\n\nexport type AgentProfileJson =\n | string\n | number\n | boolean\n | null\n | AgentProfileJson[]\n | AgentProfileJsonObject\n\nexport type AgentProfileDimensionValue = string | number | boolean | null\n\nexport interface AgentProfileSource {\n /** Runtime/profile contract being fingerprinted, e.g. `agent-interface-profile`. */\n kind: string\n /** sha256 over the canonical source profile object. */\n hash: string\n}\n\nexport interface AgentProfileSourceInput {\n kind: string\n /** Precomputed sha256 for callers that already sign their profile artifact. */\n hash?: string\n /** Full canonical runtime profile; hashed and then discarded from the cell. */\n profile?: AgentProfileJson\n}\n\nexport interface AgentProfileHarness {\n id: string\n version?: string\n hash?: string\n}\n\nexport interface AgentProfileCellInput {\n profileId: string\n sourceProfile: AgentProfileSourceInput\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport interface AgentProfileCell {\n schemaVersion: AgentProfileCellSchemaVersion\n cellId: string\n profileId: string\n sourceProfile: AgentProfileSource\n harness?: AgentProfileHarness\n model?: string\n promptHash?: string\n dimensions?: Record<string, AgentProfileDimensionValue>\n}\n\nexport class AgentProfileCellValidationError extends ValidationError {\n readonly path: string\n constructor(message: string, path = '') {\n super(path ? `${message} (at ${path})` : message)\n this.path = path\n }\n}\n\nconst SHA256_HEX = /^[0-9a-f]{64}$/\n/**\n * A cell id names the digest scheme that produced it. `sha256-rfc8785` is what\n * {@link buildAgentProfileCell} mints; the bare `sha256` form is read-only,\n * carried by cells built under an earlier release, and still verifies.\n */\nconst CELL_ID = /^agent-profile-cell:sha256(?:-rfc8785)?:[0-9a-f]{64}$/\nconst CELL_ID_PREFIX = 'agent-profile-cell:sha256-rfc8785:'\nconst LEGACY_CELL_ID_PREFIX = 'agent-profile-cell:sha256:'\n\nexport async function buildAgentProfileCell(\n input: AgentProfileCellInput,\n): Promise<AgentProfileCell> {\n const material = await normalizeAgentProfileCellInput(input)\n const cellId = `${CELL_ID_PREFIX}${await hashJson(material)}`\n return { ...material, cellId }\n}\n\nexport function agentProfileCellHashMaterial(\n cell: AgentProfileCell,\n): Omit<AgentProfileCell, 'cellId'> {\n const { cellId: _cellId, ...material } = cell\n void _cellId\n return normalizeAgentProfileCell(material)\n}\n\n/**\n * Verify an `AgentProfileCell`'s `cellId` matches the sha256 of its hash-material\n * fields, confirming the record has not been tampered with. The id names its own\n * digest scheme, so a cell minted by an earlier release verifies under that scheme.\n */\nexport async function verifyAgentProfileCell(cell: AgentProfileCell): Promise<boolean> {\n validateAgentProfileCell(cell)\n const material = agentProfileCellHashMaterial(cell)\n if (cell.cellId.startsWith(CELL_ID_PREFIX)) {\n return cell.cellId === `${CELL_ID_PREFIX}${await hashJson(material)}`\n }\n return cell.cellId === `${LEGACY_CELL_ID_PREFIX}${legacyCellDigest(material)}`\n}\n\n/**\n * Key-sorted `JSON.stringify` digest. Private and read-only: it verifies a cell\n * id minted before the RFC 8785 scheme, and no path that MINTS an id calls it.\n */\nfunction legacyCellDigest(value: unknown): string {\n return createHash('sha256')\n .update(JSON.stringify(sortKeysDeep(value)), 'utf8')\n .digest('hex')\n}\n\nfunction sortKeysDeep(value: unknown): unknown {\n if (value === null || typeof value !== 'object') return value\n if (Array.isArray(value)) return value.map(sortKeysDeep)\n const out: Record<string, unknown> = {}\n for (const key of Object.keys(value as Record<string, unknown>).sort()) {\n out[key] = sortKeysDeep((value as Record<string, unknown>)[key])\n }\n return out\n}\n\nexport function validateAgentProfileCell(input: unknown): AgentProfileCell {\n if (input === null || typeof input !== 'object') {\n throw new AgentProfileCellValidationError('expected object')\n }\n const obj = input as Record<string, unknown>\n expectLiteral(obj.schemaVersion, 'agent-profile-cell/v1', 'schemaVersion')\n if (typeof obj.cellId !== 'string' || !CELL_ID.test(obj.cellId)) {\n throw new AgentProfileCellValidationError(\n 'cellId must match agent-profile-cell:sha256:<64 lowercase hex chars>',\n 'cellId',\n )\n }\n expectString(obj.profileId, 'profileId')\n validateSource(obj.sourceProfile, 'sourceProfile')\n if (obj.harness !== undefined) validateHarness(obj.harness, 'harness')\n if (obj.model !== undefined) expectString(obj.model, 'model')\n if (obj.promptHash !== undefined) expectString(obj.promptHash, 'promptHash')\n if (obj.dimensions !== undefined) validateDimensions(obj.dimensions, 'dimensions')\n return input as AgentProfileCell\n}\n\nexport function requireAgentProfileCell(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): AgentProfileCell {\n if (!record.agentProfile) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" is missing agentProfile; profile-cell grouping requires explicit profile identity`,\n 'agentProfile',\n )\n }\n return validateAgentProfileCell(record.agentProfile)\n}\n\nexport function agentProfileCellKey(record: {\n runId: string\n agentProfile?: AgentProfileCell\n}): string {\n return requireAgentProfileCell(record).cellId\n}\n\nexport async function assertRunAgentProfileCell(record: {\n runId: string\n model: string\n promptHash: string\n agentProfile?: AgentProfileCell\n}): Promise<AgentProfileCell> {\n const profile = requireAgentProfileCell(record)\n if (!(await verifyAgentProfileCell(profile))) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" has an agentProfile.cellId that does not match its content`,\n 'agentProfile.cellId',\n )\n }\n if (profile.model !== undefined && profile.model !== record.model) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" agentProfile.model \"${profile.model}\" does not match model \"${record.model}\"`,\n 'agentProfile.model',\n )\n }\n if (profile.promptHash !== undefined && profile.promptHash !== record.promptHash) {\n throw new AgentProfileCellValidationError(\n `run \"${record.runId}\" agentProfile.promptHash \"${profile.promptHash}\" does not match promptHash \"${record.promptHash}\"`,\n 'agentProfile.promptHash',\n )\n }\n return profile\n}\n\nexport function groupRunsByAgentProfileCell<\n T extends { runId: string; agentProfile?: AgentProfileCell },\n>(records: readonly T[]): Map<string, T[]> {\n const groups = new Map<string, T[]>()\n for (const record of records) {\n const key = agentProfileCellKey(record)\n const bucket = groups.get(key)\n if (bucket) bucket.push(record)\n else groups.set(key, [record])\n }\n return groups\n}\n\nasync function normalizeAgentProfileCellInput(\n input: AgentProfileCellInput,\n): Promise<Omit<AgentProfileCell, 'cellId'>> {\n return normalizeAgentProfileCell({\n schemaVersion: 'agent-profile-cell/v1',\n profileId: input.profileId,\n sourceProfile: await normalizeSourceInput(input.sourceProfile),\n harness: input.harness,\n model: input.model,\n promptHash: input.promptHash,\n dimensions: input.dimensions,\n })\n}\n\nfunction normalizeAgentProfileCell(\n input: Omit<AgentProfileCell, 'cellId'>,\n): Omit<AgentProfileCell, 'cellId'> {\n return compactObject({\n schemaVersion: 'agent-profile-cell/v1' as const,\n profileId: requireNonEmpty(input.profileId, 'profileId'),\n sourceProfile: normalizeSource(input.sourceProfile),\n harness: input.harness ? normalizeHarness(input.harness, 'harness') : undefined,\n model: optionalNonEmpty(input.model, 'model'),\n promptHash: optionalNonEmpty(input.promptHash, 'promptHash'),\n dimensions: input.dimensions\n ? nonEmptyRecord(normalizeDimensions(input.dimensions))\n : undefined,\n })\n}\n\nasync function normalizeSourceInput(input: AgentProfileSourceInput): Promise<AgentProfileSource> {\n const kind = requireNonEmpty(input.kind, 'sourceProfile.kind')\n if (input.hash !== undefined && input.profile !== undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide either hash or profile, not both',\n 'sourceProfile',\n )\n }\n if (input.hash !== undefined) {\n return { kind, hash: requireSha256Hex(input.hash, 'sourceProfile.hash') }\n }\n if (input.profile === undefined) {\n throw new AgentProfileCellValidationError(\n 'sourceProfile must provide hash or profile',\n 'sourceProfile',\n )\n }\n assertJson(input.profile, 'sourceProfile.profile')\n return { kind, hash: await hashJson(input.profile) }\n}\n\nfunction normalizeSource(input: AgentProfileSource): AgentProfileSource {\n return {\n kind: requireNonEmpty(input.kind, 'sourceProfile.kind'),\n hash: requireSha256Hex(input.hash, 'sourceProfile.hash'),\n }\n}\n\nfunction normalizeHarness(input: AgentProfileHarness, path: string): AgentProfileHarness {\n return compactObject({\n id: requireNonEmpty(input.id, `${path}.id`),\n version: optionalNonEmpty(input.version, `${path}.version`),\n hash: optionalNonEmpty(input.hash, `${path}.hash`),\n })\n}\n\nfunction normalizeDimensions(\n input: Record<string, AgentProfileDimensionValue>,\n): Record<string, AgentProfileDimensionValue> {\n const out: Record<string, AgentProfileDimensionValue> = {}\n for (const key of Object.keys(input).sort()) {\n const value = input[key]\n requireNonEmpty(key, 'dimensions.<key>')\n if (\n value !== null &&\n typeof value !== 'string' &&\n typeof value !== 'number' &&\n typeof value !== 'boolean'\n ) {\n throw new AgentProfileCellValidationError(\n 'expected primitive dimension value',\n `dimensions.${key}`,\n )\n }\n if (typeof value === 'number' && !Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', `dimensions.${key}`)\n }\n out[key] = value\n }\n return out\n}\n\nfunction compactObject<T extends Record<string, unknown>>(input: T): T {\n const out: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(input)) {\n if (value !== undefined) out[key] = value\n }\n return out as T\n}\n\nfunction nonEmptyRecord<T extends Record<string, unknown>>(input: T): T | undefined {\n return Object.keys(input).length > 0 ? input : undefined\n}\n\nfunction validateSource(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.kind, `${path}.kind`)\n requireSha256Hex(rec.hash, `${path}.hash`)\n}\n\nfunction validateHarness(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n const rec = value as Record<string, unknown>\n expectString(rec.id, `${path}.id`)\n if (rec.version !== undefined) expectString(rec.version, `${path}.version`)\n if (rec.hash !== undefined) expectString(rec.hash, `${path}.hash`)\n}\n\nfunction validateDimensions(value: unknown, path: string): void {\n if (value === null || typeof value !== 'object' || Array.isArray(value)) {\n throw new AgentProfileCellValidationError('expected object', path)\n }\n normalizeDimensions(value as Record<string, AgentProfileDimensionValue>)\n}\n\nfunction assertJson(value: AgentProfileJson, path: string): void {\n if (value === null) return\n const type = typeof value\n if (type === 'string' || type === 'boolean') return\n if (type === 'number') {\n if (!Number.isFinite(value)) {\n throw new AgentProfileCellValidationError('expected finite number', path)\n }\n return\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => {\n assertJson(item, `${path}[${index}]`)\n })\n return\n }\n if (type === 'object') {\n for (const [key, nested] of Object.entries(value)) {\n requireNonEmpty(key, `${path}.<key>`)\n assertJson(nested, `${path}.${key}`)\n }\n return\n }\n throw new AgentProfileCellValidationError('expected JSON-compatible value', path)\n}\n\nfunction expectLiteral(value: unknown, expected: string, path: string): void {\n if (value !== expected) {\n throw new AgentProfileCellValidationError(`expected ${expected}`, path)\n }\n}\n\nfunction expectString(value: unknown, path: string): void {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n}\n\nfunction requireNonEmpty(value: string, path: string): string {\n if (typeof value !== 'string' || value.length === 0) {\n throw new AgentProfileCellValidationError('expected non-empty string', path)\n }\n return value\n}\n\nfunction optionalNonEmpty(value: string | undefined, path: string): string | undefined {\n if (value === undefined) return undefined\n return requireNonEmpty(value, path)\n}\n\nfunction requireSha256Hex(value: unknown, path: string): string {\n if (typeof value !== 'string' || !SHA256_HEX.test(value)) {\n throw new AgentProfileCellValidationError('expected 64 lowercase sha256 hex chars', path)\n }\n return value\n}\n\n// ── Consumer helpers ─────────────────────────────────────────────────\n//\n// Boilerplate every product consuming `buildAgentProfileCell` used to duplicate:\n//\n// 1. A `JSON.parse(JSON.stringify(value))` helper that canonicalizes an\n// arbitrary `@tangle-network/agent-interface` `AgentProfile` into the recursive\n// `AgentProfileJson` shape, with a fail-loud error when the profile\n// is not JSON-serializable.\n//\n// 2. The magic string `'agent-interface-profile'` for `sourceProfile.kind`.\n//\n// Both belong here so the cross-product cell join (same canonical profile\n// hashes to the same `sourceProfile.hash` across products) is enforced by\n// the type system, not by every consumer remembering to do it right.\n// See blueprint-agent issue tangle-network/agent-eval#82.\n\n/** Canonical `sourceProfile.kind` values. Two products fingerprinting the\n * same canonical profile MUST use the same kind for their cells to share\n * `sourceProfile.hash`. Extend rather than create new strings — adding a\n * new kind is a deliberate cross-product schema change. */\nexport const AGENT_PROFILE_KINDS = {\n /** A profile declared via `defineAgentProfile(...)` from\n * `@tangle-network/agent-interface`. The default kind for router-backed\n * and sandbox-backed products. */\n AGENT_INTERFACE_PROFILE: 'agent-interface-profile',\n} as const\n\nexport type AgentProfileKind = (typeof AGENT_PROFILE_KINDS)[keyof typeof AGENT_PROFILE_KINDS]\n\n/** Canonicalize an arbitrary value into `AgentProfileJson` by JSON\n * round-trip. Throws when the value contains anything not representable\n * as JSON (functions, BigInt, cycles) — non-portable profiles fail loud\n * rather than silently dropping fields. */\nexport function toAgentProfileJson(value: unknown): AgentProfileJson {\n let serialized: string | undefined\n try {\n serialized = JSON.stringify(value)\n } catch (err) {\n throw new AgentProfileCellValidationError(\n `agent profile must be JSON-serializable: ${err instanceof Error ? err.message : String(err)}`,\n 'sourceProfile.profile',\n )\n }\n if (serialized === undefined) {\n throw new AgentProfileCellValidationError(\n 'agent profile must be JSON-serializable (got undefined after JSON.stringify)',\n 'sourceProfile.profile',\n )\n }\n return JSON.parse(serialized) as AgentProfileJson\n}\n\n/** Canonical AgentProfile shape required when deriving a stable cell id. */\nexport type AgentInterfaceProfileLike = AgentProfile & { name: string; version: string }\n\n/** Higher-level helper that hard-codes the canonical\n * `agent-interface-profile` kind plus the JSON canonicalization. Equivalent\n * to calling `buildAgentProfileCell` with `profileId = \\`${name}@${version}\\``\n * and `sourceProfile = { kind: AGENT_INTERFACE_PROFILE, profile: <round-tripped> }`.\n *\n * Use this from any product consuming an agent-interface `AgentProfile`; the\n * manual `buildAgentProfileCell` call is reserved for advanced cases\n * (custom kinds, pre-computed source hashes, alternate profileId\n * conventions). */\nexport async function buildAgentInterfaceProfileCell(\n profile: AgentInterfaceProfileLike,\n input: Omit<AgentProfileCellInput, 'profileId' | 'sourceProfile'>,\n): Promise<AgentProfileCell> {\n if (!profile || typeof profile !== 'object') {\n throw new AgentProfileCellValidationError('AgentProfile must be an object', 'profile')\n }\n if (typeof profile.name !== 'string' || profile.name.length === 0) {\n throw new AgentProfileCellValidationError(\n 'AgentProfile must have a non-empty `name`',\n 'profile.name',\n )\n }\n if (typeof profile.version !== 'string' || profile.version.length === 0) {\n throw new AgentProfileCellValidationError(\n 'AgentProfile must have a non-empty `version`',\n 'profile.version',\n )\n }\n return buildAgentProfileCell({\n ...input,\n profileId: `${profile.name}@${profile.version}`,\n sourceProfile: {\n kind: AGENT_PROFILE_KINDS.AGENT_INTERFACE_PROFILE,\n profile: toAgentProfileJson(profile),\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoGA,eAAsB,SAAY,KAAyB;CACzD,OAAO,cAAc,GAAG,CAAC,CAAC,MAAM,CAAgB;AAClD;;;;;;AAOA,SAAS,oBAAoB,OAAwB;CACnD,OAAO,WAAW,QAAQ,CAAC,CACxB,OAAO,KAAK,UAAUA,eAAa,KAAK,CAAC,GAAG,MAAM,CAAC,CACnD,OAAO,KAAK;AACjB;AAEA,SAASA,eAAa,OAAyB;CAC7C,IAAI,UAAU,Q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AAK,WAAW,GAC9D,MAAM,IAAI,gCACR,6CACA,cACF;CAEF,IAAI,OAAO,QAAQ,YAAY,YAAY,QAAQ,QAAQ,WAAW,GACpE,MAAM,IAAI,gCACR,gDACA,iBACF;CAEF,OAAO,sBAAsB;EAC3B,GAAG;EACH,WAAW,GAAG,QAAQ,KAAK,GAAG,QAAQ;EACtC,eAAe;GACb,MAAM,oBAAoB;GAC1B,SAAS,mBAAmB,OAAO;EACrC;CACF,CAAC;AACH"}
|
package/dist/analyst/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { a as ExactAnalystBudgetPolicy, c as RegistryRunOpts, i as BudgetPolicy,
|
|
|
7
7
|
import { a as createTraceAnalyst, c as BehavioralAnalystOptions, i as TraceAnalystDefinition, l as behavioralAnalyst, n as buildDefaultAnalystRegistry, o as renderPriorFindings, r as CreateTraceAnalystOptions, s as runTraceAnalyst, t as DefaultAnalystRegistryOptions, u as deriveEfficiencyFindings } from "../default-registry-FfNzaUHV.js";
|
|
8
8
|
import { a as TraceAnalystLimits, c as RawAnalystEvidence, d as evidenceRefsFromRawFinding, f as parseRawFinding, i as TraceAnalysisEngineResult, l as RawAnalystFinding, n as TraceAnalysisEngine, o as resolveTraceAnalystLimits, r as TraceAnalysisEngineRequest, s as RAW_FINDING_SCHEMA_PROMPT, t as DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, u as RawAnalystFindingSchema } from "../engine-CvW_I72-.js";
|
|
9
9
|
import { n as buildTraceToolsForGroup, t as TraceToolGroupName } from "../tool-groups-DAe1t6zb.js";
|
|
10
|
-
import { A as SemanticConceptJudgeInput, C as DspyRlmTraceEngineOptions, E as createChatTraceEngine, S as renderFindingSubject, T as ChatTraceEngineOptions, _ as FindingSubject, a as FAILURE_MODE_KIND_SPEC, b as findingSubjectGrammarPromptFor, c as emitControlIntegrityFindings, d as FindingsStore, f as PersistedFinding, g as FINDING_SUBJECT_SYNTAX, h as FINDING_SUBJECT_KINDS, i as IMPROVEMENT_KIND_SPEC, j as SemanticConceptJudgeOptions, l as DiffPolicy, m as diffFindings, n as KNOWLEDGE_POISONING_KIND_SPEC, o as CONTROL_INTEGRITY_ANALYST, p as defaultIsMaterial, r as KNOWLEDGE_GAP_KIND_SPEC, s as ControlIntegrityAnalyst, t as DEFAULT_TRACE_ANALYST_KINDS, u as FindingsDiff, v as FindingSubjectKind, w as createDspyRlmTraceEngine, x as parseFindingSubject, y as KIND_EXPECTED_SUBJECTS } from "../index-
|
|
10
|
+
import { A as SemanticConceptJudgeInput, C as DspyRlmTraceEngineOptions, E as createChatTraceEngine, S as renderFindingSubject, T as ChatTraceEngineOptions, _ as FindingSubject, a as FAILURE_MODE_KIND_SPEC, b as findingSubjectGrammarPromptFor, c as emitControlIntegrityFindings, d as FindingsStore, f as PersistedFinding, g as FINDING_SUBJECT_SYNTAX, h as FINDING_SUBJECT_KINDS, i as IMPROVEMENT_KIND_SPEC, j as SemanticConceptJudgeOptions, l as DiffPolicy, m as diffFindings, n as KNOWLEDGE_POISONING_KIND_SPEC, o as CONTROL_INTEGRITY_ANALYST, p as defaultIsMaterial, r as KNOWLEDGE_GAP_KIND_SPEC, s as ControlIntegrityAnalyst, t as DEFAULT_TRACE_ANALYST_KINDS, u as FindingsDiff, v as FindingSubjectKind, w as createDspyRlmTraceEngine, x as parseFindingSubject, y as KIND_EXPECTED_SUBJECTS } from "../index-BAAiSF3_.js";
|
|
11
11
|
import { i as nodeHttpPrimeBridgeTransport, n as PrimeBridgeTransportRequest, r as PrimeBridgeTransportResult, t as PrimeBridgeTransport } from "../prime-bridge-transport-6feEglLf.js";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
//#region src/analyst/adapters.d.ts
|
|
@@ -1265,11 +1265,11 @@ declare function runAnalystBenchmarkCommand(argv: readonly string[], env?: NodeJ
|
|
|
1265
1265
|
declare const ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM = "sha256-canonical-source-manifest";
|
|
1266
1266
|
declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM = "sha256-canonical-file-manifest";
|
|
1267
1267
|
declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES: readonly string[];
|
|
1268
|
-
declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "
|
|
1268
|
+
declare const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "40ab03deeac3102cefe9aebb106e24e85dc107adbfc4764555a91765a8b05d36";
|
|
1269
1269
|
declare const ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256 = "1e03f2daed356d60316aabefb407ec1e437ac94d408d61eea4ae096e9c6fbb5b";
|
|
1270
1270
|
declare const ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256 = "4dba263b6256a30d56c7fdb2d992d3a953c0035d731f359b704db806f68f75ac";
|
|
1271
1271
|
declare const ANALYST_BENCHMARK_IMPLEMENTATION_FILES: readonly string[];
|
|
1272
|
-
declare const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "
|
|
1272
|
+
declare const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "40fc3ab8cf919c097ec37f1e17c8db441855544dd68fd6dd95c2f7c434457d03";
|
|
1273
1273
|
declare function analystBenchmarkImplementationDigest(): string;
|
|
1274
1274
|
declare function analystBenchmarkDependencyLockDigest(): string;
|
|
1275
1275
|
//#endregion
|
package/dist/analyst/index.js
CHANGED
|
@@ -2,12 +2,12 @@ import { i as CostLedger } from "../cost-ledger-B1qx30B4.js";
|
|
|
2
2
|
import { n as assertProposalFindings, r as isProposalFinding } from "../abort-signal-CtzAM_sJ.js";
|
|
3
3
|
import { c as validateUsageSettlementTimeout, i as makeProposalFinding, n as computeFindingId, o as settleUsageReceiptFromCostLedger, r as makeFinding } from "../types-DQ0e2E7y.js";
|
|
4
4
|
import { A as RAW_FINDING_SCHEMA_PROMPT, B as parseFindingSubject, F as stripCodeFences, H as DEFAULT_TRACE_ANALYST_OUTPUT_TOKENS, I as FINDING_SUBJECT_KINDS, L as FINDING_SUBJECT_SYNTAX, M as evidenceRefsFromRawFinding, N as parseRawFinding, P as coerceJson, R as KIND_EXPECTED_SUBJECTS, U as resolveTraceAnalystLimits, V as renderFindingSubject, i as buildTraceToolsForGroup, j as RawAnalystFindingSchema, n as renderPriorFindings, r as runTraceAnalyst, t as createTraceAnalyst, z as findingSubjectGrammarPromptFor } from "../kind-factory-BLvL-E44.js";
|
|
5
|
-
import { a as KNOWLEDGE_POISONING_KIND_SPEC, c as FAILURE_MODE_KIND_SPEC, d as emitControlIntegrityFindings, f as behavioralAnalyst, i as DEFAULT_TRACE_ANALYST_KINDS, l as CONTROL_INTEGRITY_ANALYST, n as AnalystRegistry, o as KNOWLEDGE_GAP_KIND_SPEC, p as deriveEfficiencyFindings, r as ExactAnalystRunExecutionError, s as IMPROVEMENT_KIND_SPEC, t as buildDefaultAnalystRegistry, u as ControlIntegrityAnalyst } from "../default-registry-
|
|
6
|
-
import { t as createDspyRlmTraceEngine } from "../dspy-rlm-engine-
|
|
7
|
-
import { a as diffFindings, i as defaultIsMaterial, n as runSemanticConceptJudge, o as createChatTraceEngine, r as FindingsStore, t as SEMANTIC_CONCEPT_JUDGE_VERSION } from "../semantic-concept-judge-
|
|
5
|
+
import { a as KNOWLEDGE_POISONING_KIND_SPEC, c as FAILURE_MODE_KIND_SPEC, d as emitControlIntegrityFindings, f as behavioralAnalyst, i as DEFAULT_TRACE_ANALYST_KINDS, l as CONTROL_INTEGRITY_ANALYST, n as AnalystRegistry, o as KNOWLEDGE_GAP_KIND_SPEC, p as deriveEfficiencyFindings, r as ExactAnalystRunExecutionError, s as IMPROVEMENT_KIND_SPEC, t as buildDefaultAnalystRegistry, u as ControlIntegrityAnalyst } from "../default-registry-DBqVI4pq.js";
|
|
6
|
+
import { t as createDspyRlmTraceEngine } from "../dspy-rlm-engine-DqjER2sV.js";
|
|
7
|
+
import { a as diffFindings, i as defaultIsMaterial, n as runSemanticConceptJudge, o as createChatTraceEngine, r as FindingsStore, t as SEMANTIC_CONCEPT_JUDGE_VERSION } from "../semantic-concept-judge-Dw-f7TEs.js";
|
|
8
8
|
import { t as createChatClient } from "../chat-client-CkmjYlfB.js";
|
|
9
9
|
import { a as scoreAnalystFindings, i as summarizeAnalystBenchmarkRunner, n as runAnalystBenchmark, r as traceStoreEvidenceResolver, t as registryBenchmarkRunner } from "../benchmark-DQKzykkO.js";
|
|
10
|
-
import { $ as ANALYST_BENCHMARK_LOCAL_RECEIPT_FILE, A as effectiveAnalystProtocolSha256, B as loadCodeTraceVerificationArtifacts, C as adaptPublicBenchmarkFindings, D as renderCodeTraceCalibrationMarkdown, E as readAnalystBenchmarkArtifact, F as publicBenchmarkProtocolSha256, G as ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256, H as ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM, I as publicBenchmarkRlmInstructions, J as ANALYST_BENCHMARK_IMPLEMENTATION_FILES, K as ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256, L as publicBenchmarkSystemPrompt, M as CODE_TRACE_BENCH_ANALYST_PROMPT, N as MAX_INCORRECT_BLOCKS, O as summarizeCodeTraceCalibration, P as MAX_INCORRECT_BLOCK_STEPS, Q as ANALYST_BENCHMARK_COST_LEDGER_FILE, R as DEFAULT_MAX_VERIFICATION_ARTIFACT_BYTES, S as analystDefinitionProtocolSha256, T as expandCodeTraceFailureBlocks, U as ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES, V as parseVerificationOutcome, W as ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256, X as analystBenchmarkDependencyLockDigest, Y as ANALYST_BENCHMARK_IMPLEMENTATION_SHA256, Z as analystBenchmarkImplementationDigest, _ as createPublicBenchmarkDirectRunner, a as primeCodeTraceAnalystDefinition, at as summarizeAgentRxCalibration, b as AnalystExpressivenessError, c as loadPublicBenchmarkRows, ct as agentRxBenchmarkCase, d as publicBenchmarkSelectionReport, dt as roundAgentRxStep, et as ANALYST_BENCHMARK_MANIFEST_FILE, f as selectPublicBenchmarkRows, ft as normalizeBenchmarkLabel, g as runReplVariableAnalystDefinition, h as rlmEngineLimits, i as primeAnalystProtocolSha256, it as renderAgentRxCalibrationMarkdown, j as readAnalystInstructionsOverride, k as analystInstructionsOverrideFromText, l as preparePublicAnalystBenchmark, lt as agentRxPredictionsToFindings, m as publicRlmAnalystDefinition, n as renderAnalystBenchmarkMarkdown, nt as compareAnalystRunners, o as runInlineAnalystDefinition, ot as codeTraceBenchCase, p as createPublicBenchmarkRlmRunner, q as ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM, r as createPrimeBenchmarkRunner, rt as AGENT_RX_UPSTREAM_REVISION, s as nodeHttpPrimeBridgeTransport, st as codeTracerPredictionsToFindings, t as runAnalystBenchmarkCommand, tt as ANALYST_BENCHMARK_OBSERVATIONS_FILE, u as publicBenchmarkDistributions, ut as normalizeAgentRxCategory, v as publicDirectAnalystDefinition, w as emptyPublicBenchmarkRunner, x as analystDefinitionAsymmetries, y as runChunkedAnalystDefinition, z as appendVerificationArtifactsToOtlp } from "../benchmark-command-
|
|
10
|
+
import { $ as ANALYST_BENCHMARK_LOCAL_RECEIPT_FILE, A as effectiveAnalystProtocolSha256, B as loadCodeTraceVerificationArtifacts, C as adaptPublicBenchmarkFindings, D as renderCodeTraceCalibrationMarkdown, E as readAnalystBenchmarkArtifact, F as publicBenchmarkProtocolSha256, G as ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256, H as ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM, I as publicBenchmarkRlmInstructions, J as ANALYST_BENCHMARK_IMPLEMENTATION_FILES, K as ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256, L as publicBenchmarkSystemPrompt, M as CODE_TRACE_BENCH_ANALYST_PROMPT, N as MAX_INCORRECT_BLOCKS, O as summarizeCodeTraceCalibration, P as MAX_INCORRECT_BLOCK_STEPS, Q as ANALYST_BENCHMARK_COST_LEDGER_FILE, R as DEFAULT_MAX_VERIFICATION_ARTIFACT_BYTES, S as analystDefinitionProtocolSha256, T as expandCodeTraceFailureBlocks, U as ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES, V as parseVerificationOutcome, W as ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256, X as analystBenchmarkDependencyLockDigest, Y as ANALYST_BENCHMARK_IMPLEMENTATION_SHA256, Z as analystBenchmarkImplementationDigest, _ as createPublicBenchmarkDirectRunner, a as primeCodeTraceAnalystDefinition, at as summarizeAgentRxCalibration, b as AnalystExpressivenessError, c as loadPublicBenchmarkRows, ct as agentRxBenchmarkCase, d as publicBenchmarkSelectionReport, dt as roundAgentRxStep, et as ANALYST_BENCHMARK_MANIFEST_FILE, f as selectPublicBenchmarkRows, ft as normalizeBenchmarkLabel, g as runReplVariableAnalystDefinition, h as rlmEngineLimits, i as primeAnalystProtocolSha256, it as renderAgentRxCalibrationMarkdown, j as readAnalystInstructionsOverride, k as analystInstructionsOverrideFromText, l as preparePublicAnalystBenchmark, lt as agentRxPredictionsToFindings, m as publicRlmAnalystDefinition, n as renderAnalystBenchmarkMarkdown, nt as compareAnalystRunners, o as runInlineAnalystDefinition, ot as codeTraceBenchCase, p as createPublicBenchmarkRlmRunner, q as ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM, r as createPrimeBenchmarkRunner, rt as AGENT_RX_UPSTREAM_REVISION, s as nodeHttpPrimeBridgeTransport, st as codeTracerPredictionsToFindings, t as runAnalystBenchmarkCommand, tt as ANALYST_BENCHMARK_OBSERVATIONS_FILE, u as publicBenchmarkDistributions, ut as normalizeAgentRxCategory, v as publicDirectAnalystDefinition, w as emptyPublicBenchmarkRunner, x as analystDefinitionAsymmetries, y as runChunkedAnalystDefinition, z as appendVerificationArtifactsToOtlp } from "../benchmark-command-yPqjcZnC.js";
|
|
11
11
|
import { a as extractPrimeJsonObject, c as primeProtocolSha256, d as runPrimeExchange, f as decodeReplyRows, i as emptyPrimeRawUsage, l as primeReplyDefect, n as buildPrimePrompt, o as mergePrimeRawUsage, r as buildPrimeRepairPrompt, s as normalizePrimeUsage, t as analystUsageReceiptFromPrimeUsage, u as projectPrimeTrajectory } from "../prime-protocol-6tZTVsWm.js";
|
|
12
12
|
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
13
13
|
import { join } from "node:path";
|
|
@@ -3,15 +3,15 @@ import { a as hashCanonical, i as compareCodeUnits, o as jsonDocument, r as cano
|
|
|
3
3
|
import { r as pairedBootstrap } from "./paired-tests-C8iCsioC.js";
|
|
4
4
|
import { a as resolveModelPricing } from "./metrics-Qv-cpptD.js";
|
|
5
5
|
import { a as CostLedgerPersistenceError, i as CostLedger, n as CostCallConflictError, o as CostReceiptCaptureError, r as CostCeilingReachedError, s as CostReservationExceededError, t as CostAccountingIncompleteError } from "./cost-ledger-B1qx30B4.js";
|
|
6
|
-
import { c as
|
|
7
|
-
import { S as fsCampaignStorage, i as startExternalOptimizerModelProxy, r as runWithCleanup, x as createRunCostLedger, y as resolveExternalOptimizerProcessLimits } from "./external-optimizer-subprocess-
|
|
6
|
+
import { c as withLedgerFileLock, l as writeLedgerFileAtomically } from "./ledger-core-Cs9f7385.js";
|
|
7
|
+
import { S as fsCampaignStorage, i as startExternalOptimizerModelProxy, r as runWithCleanup, x as createRunCostLedger, y as resolveExternalOptimizerProcessLimits } from "./external-optimizer-subprocess-q3VzlGAO.js";
|
|
8
8
|
import { r as makeFinding, s as usageReceiptFromCostLedger } from "./types-DQ0e2E7y.js";
|
|
9
9
|
import { A as RAW_FINDING_SCHEMA_PROMPT, M as evidenceRefsFromRawFinding, j as RawAnalystFindingSchema, m as TRACE_ANALYSIS_LIMITS, r as runTraceAnalyst } from "./kind-factory-BLvL-E44.js";
|
|
10
10
|
import { a as callLlmJson, r as LlmResponseError, t as LlmCallError } from "./llm-client-CGlSi8sb.js";
|
|
11
|
-
import { t as createDspyRlmTraceEngine } from "./dspy-rlm-engine-
|
|
11
|
+
import { t as createDspyRlmTraceEngine } from "./dspy-rlm-engine-DqjER2sV.js";
|
|
12
12
|
import { i as otlpTextToTraceAnalysisStore, r as createOtlpBufferTraceStore, t as DEFAULT_MAX_TRACE_FILE_BYTES } from "./store-otlp-DV_H2HDu.js";
|
|
13
13
|
import { i as summarizeAnalystBenchmarkRunner, n as runAnalystBenchmark, r as traceStoreEvidenceResolver } from "./benchmark-DQKzykkO.js";
|
|
14
|
-
import { n as acquireSingleRunLock } from "./external-optimizer-process-
|
|
14
|
+
import { n as acquireSingleRunLock } from "./external-optimizer-process-Dlz8YxrT.js";
|
|
15
15
|
import { c as primeProtocolSha256, d as runPrimeExchange, f as decodeReplyRows, n as buildPrimePrompt, p as assertEqualDeclarativeTerms, t as analystUsageReceiptFromPrimeUsage, u as projectPrimeTrajectory } from "./prime-protocol-6tZTVsWm.js";
|
|
16
16
|
import { createHash, randomUUID } from "node:crypto";
|
|
17
17
|
import { constants, existsSync, lstatSync, readFileSync } from "node:fs";
|
|
@@ -1412,7 +1412,7 @@ const ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES = Object.freeze([
|
|
|
1412
1412
|
"package.json",
|
|
1413
1413
|
"pnpm-lock.yaml"
|
|
1414
1414
|
]);
|
|
1415
|
-
const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "
|
|
1415
|
+
const ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 = "40ab03deeac3102cefe9aebb106e24e85dc107adbfc4764555a91765a8b05d36";
|
|
1416
1416
|
const ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256 = "1e03f2daed356d60316aabefb407ec1e437ac94d408d61eea4ae096e9c6fbb5b";
|
|
1417
1417
|
const ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256 = "4dba263b6256a30d56c7fdb2d992d3a953c0035d731f359b704db806f68f75ac";
|
|
1418
1418
|
const ANALYST_BENCHMARK_IMPLEMENTATION_FILES = Object.freeze([
|
|
@@ -1525,7 +1525,7 @@ const ANALYST_BENCHMARK_IMPLEMENTATION_FILES = Object.freeze([
|
|
|
1525
1525
|
"src/trace/raw-provider-sink.ts",
|
|
1526
1526
|
"src/verdict-cache.ts"
|
|
1527
1527
|
]);
|
|
1528
|
-
const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "
|
|
1528
|
+
const ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 = "40fc3ab8cf919c097ec37f1e17c8db441855544dd68fd6dd95c2f7c434457d03";
|
|
1529
1529
|
function analystBenchmarkImplementationDigest() {
|
|
1530
1530
|
return ANALYST_BENCHMARK_IMPLEMENTATION_SHA256;
|
|
1531
1531
|
}
|
|
@@ -6351,4 +6351,4 @@ function shellQuote(value) {
|
|
|
6351
6351
|
//#endregion
|
|
6352
6352
|
export { ANALYST_BENCHMARK_LOCAL_RECEIPT_FILE as $, effectiveAnalystProtocolSha256 as A, loadCodeTraceVerificationArtifacts as B, adaptPublicBenchmarkFindings as C, renderCodeTraceCalibrationMarkdown as D, readAnalystBenchmarkArtifact as E, publicBenchmarkProtocolSha256 as F, ANALYST_BENCHMARK_EVIDENCE_DEPENDENCY_LOCK_SHA256 as G, ANALYST_BENCHMARK_DEPENDENCY_LOCK_DIGEST_ALGORITHM as H, publicBenchmarkRlmInstructions as I, ANALYST_BENCHMARK_IMPLEMENTATION_FILES as J, ANALYST_BENCHMARK_EVIDENCE_IMPLEMENTATION_SHA256 as K, publicBenchmarkSystemPrompt as L, CODE_TRACE_BENCH_ANALYST_PROMPT as M, MAX_INCORRECT_BLOCKS as N, summarizeCodeTraceCalibration as O, MAX_INCORRECT_BLOCK_STEPS as P, ANALYST_BENCHMARK_COST_LEDGER_FILE as Q, DEFAULT_MAX_VERIFICATION_ARTIFACT_BYTES as R, analystDefinitionProtocolSha256 as S, expandCodeTraceFailureBlocks as T, ANALYST_BENCHMARK_DEPENDENCY_LOCK_FILES as U, parseVerificationOutcome as V, ANALYST_BENCHMARK_DEPENDENCY_LOCK_SHA256 as W, analystBenchmarkDependencyLockDigest as X, ANALYST_BENCHMARK_IMPLEMENTATION_SHA256 as Y, analystBenchmarkImplementationDigest as Z, createPublicBenchmarkDirectRunner as _, primeCodeTraceAnalystDefinition as a, summarizeAgentRxCalibration as at, AnalystExpressivenessError as b, loadPublicBenchmarkRows as c, agentRxBenchmarkCase as ct, publicBenchmarkSelectionReport as d, roundAgentRxStep as dt, ANALYST_BENCHMARK_MANIFEST_FILE as et, selectPublicBenchmarkRows as f, normalizeBenchmarkLabel as ft, runReplVariableAnalystDefinition as g, rlmEngineLimits as h, primeAnalystProtocolSha256 as i, renderAgentRxCalibrationMarkdown as it, readAnalystInstructionsOverride as j, analystInstructionsOverrideFromText as k, preparePublicAnalystBenchmark as l, agentRxPredictionsToFindings as lt, publicRlmAnalystDefinition as m, renderAnalystBenchmarkMarkdown as n, compareAnalystRunners as nt, runInlineAnalystDefinition as o, codeTraceBenchCase as ot, createPublicBenchmarkRlmRunner as p, ANALYST_BENCHMARK_IMPLEMENTATION_DIGEST_ALGORITHM as q, createPrimeBenchmarkRunner as r, AGENT_RX_UPSTREAM_REVISION as rt, nodeHttpPrimeBridgeTransport as s, codeTracerPredictionsToFindings as st, runAnalystBenchmarkCommand as t, ANALYST_BENCHMARK_OBSERVATIONS_FILE as tt, publicBenchmarkDistributions as u, normalizeAgentRxCategory as ut, publicDirectAnalystDefinition as v, emptyPublicBenchmarkRunner as w, analystDefinitionAsymmetries as x, runChunkedAnalystDefinition as y, appendVerificationArtifactsToOtlp as z };
|
|
6353
6353
|
|
|
6354
|
-
//# sourceMappingURL=benchmark-command-
|
|
6354
|
+
//# sourceMappingURL=benchmark-command-yPqjcZnC.js.map
|