@tangle-network/agent-eval 0.136.0 → 0.137.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 +38 -1
- package/README.md +4 -2
- package/dist/{agent-profile-cell-OhuTee9n.js → agent-profile-cell-CbfBm2g6.js} +2 -2
- package/dist/{agent-profile-cell-OhuTee9n.js.map → agent-profile-cell-CbfBm2g6.js.map} +1 -1
- package/dist/{agent-profile-cell-CCm3l2v2.d.ts → agent-profile-cell-Cw0PVwDr.d.ts} +2 -2
- package/dist/{agent-profile-cell-CCm3l2v2.d.ts.map → agent-profile-cell-Cw0PVwDr.d.ts.map} +1 -1
- package/dist/analyst/index.d.ts +139 -17
- package/dist/analyst/index.d.ts.map +1 -1
- package/dist/analyst/index.js +606 -4
- package/dist/analyst/index.js.map +1 -1
- package/dist/{analyze-runs-jjCmF8pU.js → analyze-runs-BScZvqMV.js} +6 -6
- package/dist/{analyze-runs-jjCmF8pU.js.map → analyze-runs-BScZvqMV.js.map} +1 -1
- package/dist/{analyze-runs-Cda5Xkj1.d.ts → analyze-runs-PVtnfjvA.d.ts} +6 -6
- package/dist/{analyze-runs-Cda5Xkj1.d.ts.map → analyze-runs-PVtnfjvA.d.ts.map} +1 -1
- package/dist/{baseline-BUeFcgrn.js → baseline-C-GocmIW.js} +2 -2
- package/dist/{baseline-BUeFcgrn.js.map → baseline-C-GocmIW.js.map} +1 -1
- package/dist/benchmark-CHX4orG7.d.ts +184 -0
- package/dist/benchmark-CHX4orG7.d.ts.map +1 -0
- package/dist/benchmark-YDrpumqB.js +414 -0
- package/dist/benchmark-YDrpumqB.js.map +1 -0
- package/dist/benchmarks/index.d.ts +1 -1
- package/dist/benchmarks/index.js +1 -1
- package/dist/{benchmarks-Dfgm9ts5.js → benchmarks-DCLkQOmc.js} +3 -3
- package/dist/{benchmarks-Dfgm9ts5.js.map → benchmarks-DCLkQOmc.js.map} +1 -1
- package/dist/builder-eval/index.js +2 -2
- package/dist/campaign/index.d.ts +6 -6
- package/dist/campaign/index.js +3 -3
- package/dist/{campaign-Dz8uQnhC.js → campaign-lgObcHFC.js} +212 -78
- package/dist/campaign-lgObcHFC.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/client-C8L6h6Wf.d.ts +202 -0
- package/dist/client-C8L6h6Wf.d.ts.map +1 -0
- package/dist/completion-verifier-DSyRNVzU.d.ts +240 -0
- package/dist/completion-verifier-DSyRNVzU.d.ts.map +1 -0
- package/dist/contract/index.d.ts +10 -9
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +10 -10
- package/dist/control.d.ts +2 -2
- package/dist/control.js +1 -1
- package/dist/{cost-ledger-DHAjwNj7.js → cost-ledger-D-5_-dhi.js} +2 -2
- package/dist/{cost-ledger-DHAjwNj7.js.map → cost-ledger-D-5_-dhi.js.map} +1 -1
- package/dist/{cost-ledger-fGS_u_O1.d.ts → cost-ledger-D2o6JOrL.d.ts} +2 -2
- package/dist/{cost-ledger-fGS_u_O1.d.ts.map → cost-ledger-D2o6JOrL.d.ts.map} +1 -1
- package/dist/{dataset-BvtnC8Dc.d.ts → dataset-v_Y5902-.d.ts} +2 -2
- package/dist/{dataset-BvtnC8Dc.d.ts.map → dataset-v_Y5902-.d.ts.map} +1 -1
- package/dist/{default-registry-CHmdy2An.js → default-registry-CLXbRt0f.js} +119 -38
- package/dist/default-registry-CLXbRt0f.js.map +1 -0
- package/dist/{default-registry-Brxr728w.d.ts → default-registry-Dc5D_Loc.d.ts} +63 -137
- package/dist/default-registry-Dc5D_Loc.d.ts.map +1 -0
- package/dist/{errors-8YnH8WlF.js → errors-D-LKuDhb.js} +8 -2
- package/dist/errors-D-LKuDhb.js.map +1 -0
- package/dist/{errors-CEk209JS.d.ts → errors-DkfjIDvD.d.ts} +9 -3
- package/dist/errors-DkfjIDvD.d.ts.map +1 -0
- package/dist/{eval-campaign-Cc8WZJ6b.js → eval-campaign-CHqfLnff.js} +6 -6
- package/dist/{eval-campaign-Cc8WZJ6b.js.map → eval-campaign-CHqfLnff.js.map} +1 -1
- package/dist/{extract-usage-DIQpN-ww.js → extract-usage-p-56bh8q.js} +3 -3
- package/dist/{extract-usage-DIQpN-ww.js.map → extract-usage-p-56bh8q.js.map} +1 -1
- package/dist/{feedback-trajectory-CVaeREXV.d.ts → feedback-trajectory-N_F0PwHz.d.ts} +90 -3
- package/dist/feedback-trajectory-N_F0PwHz.d.ts.map +1 -0
- package/dist/fuzz.d.ts +1 -1
- package/dist/fuzz.js +2 -2
- package/dist/hosted/index.d.ts +3 -2
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/index-BipJlj-C.d.ts +316 -0
- package/dist/index-BipJlj-C.d.ts.map +1 -0
- package/dist/{index-CQsJcqch.d.ts → index-BnP1QJUv.d.ts} +5 -5
- package/dist/{index-CQsJcqch.d.ts.map → index-BnP1QJUv.d.ts.map} +1 -1
- package/dist/{index-B4Fjfo5U.d.ts → index-C-Pr4OWg.d.ts} +88 -317
- package/dist/index-C-Pr4OWg.d.ts.map +1 -0
- package/dist/{index-DuhJaaiH.d.ts → index-DEb46kc6.d.ts} +2 -2
- package/dist/{index-DuhJaaiH.d.ts.map → index-DEb46kc6.d.ts.map} +1 -1
- package/dist/{index-C2fkZhv_.d.ts → index-DRNl6g_N.d.ts} +3 -3
- package/dist/{index-C2fkZhv_.d.ts.map → index-DRNl6g_N.d.ts.map} +1 -1
- package/dist/{index-AbhwHp0V.d.ts → index-U3RHOShi.d.ts} +2 -2
- package/dist/{index-AbhwHp0V.d.ts.map → index-U3RHOShi.d.ts.map} +1 -1
- package/dist/index.d.ts +29 -70
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +507 -33
- package/dist/index.js.map +1 -1
- package/dist/{client-DcvgkaZi.d.ts → insight-report-B9ooYH_g.d.ts} +5 -203
- package/dist/insight-report-B9ooYH_g.d.ts.map +1 -0
- package/dist/integrity-CCXTftiL.js +1360 -0
- package/dist/integrity-CCXTftiL.js.map +1 -0
- package/dist/{integrity-rmVhXWA7.d.ts → integrity-CKxosZ5Z.d.ts} +3 -3
- package/dist/{integrity-rmVhXWA7.d.ts.map → integrity-CKxosZ5Z.d.ts.map} +1 -1
- package/dist/{integrity-BzRbCHzi.js → integrity-fdt8XPAv.js} +2 -2
- package/dist/{integrity-BzRbCHzi.js.map → integrity-fdt8XPAv.js.map} +1 -1
- package/dist/ledger-core/index.d.ts +1 -1
- package/dist/ledger-core/index.js +1 -1
- package/dist/{ledger-core-DAKFKRzi.js → ledger-core-t6sItivm.js} +85 -85
- package/dist/{ledger-core-DAKFKRzi.js.map → ledger-core-t6sItivm.js.map} +1 -1
- package/dist/{llm-client-DHx8pzyJ.js → llm-client-DKB25jV8.js} +3 -3
- package/dist/{llm-client-DHx8pzyJ.js.map → llm-client-DKB25jV8.js.map} +1 -1
- package/dist/meta-eval/index.d.ts +2 -2
- package/dist/meta-eval/index.js +3 -3
- package/dist/{mint-DyRUc9k6.js → mint-Ctwk079K.js} +4 -4
- package/dist/{mint-DyRUc9k6.js.map → mint-Ctwk079K.js.map} +1 -1
- package/dist/multishot/index.d.ts +2 -2
- package/dist/openapi.json +1 -1
- package/dist/{paired-arms-BbFKrAU-.js → paired-arms-iZ08VFMN.js} +3 -3
- package/dist/{paired-arms-BbFKrAU-.js.map → paired-arms-iZ08VFMN.js.map} +1 -1
- package/dist/pipelines/index.js +2 -2
- package/dist/profile-cell.d.ts +1 -1
- package/dist/profile-cell.js +1 -1
- package/dist/{propose-review-control-SQ-n9-We.js → propose-review-control-DLXz4FCX.js} +2 -2
- package/dist/{propose-review-control-SQ-n9-We.js.map → propose-review-control-DLXz4FCX.js.map} +1 -1
- package/dist/registry-BdM7SuTr.d.ts +124 -0
- package/dist/registry-BdM7SuTr.d.ts.map +1 -0
- package/dist/{release-report-DooPguBc.js → release-report-B5XPBvAU.js} +4 -4
- package/dist/{release-report-DooPguBc.js.map → release-report-B5XPBvAU.js.map} +1 -1
- package/dist/{release-report-DpBxGGI1.d.ts → release-report-CofgVNZt.d.ts} +4 -4
- package/dist/{release-report-DpBxGGI1.d.ts.map → release-report-CofgVNZt.d.ts.map} +1 -1
- package/dist/{replay-C6wRg47C.js → replay-Bju0T8Ls.js} +248 -8
- package/dist/replay-Bju0T8Ls.js.map +1 -0
- package/dist/{replay-BRfMIs81.d.ts → replay-K8FaC0CB.d.ts} +227 -52
- package/dist/replay-K8FaC0CB.d.ts.map +1 -0
- package/dist/reporting.d.ts +4 -4
- package/dist/reporting.js +4 -4
- package/dist/{researcher-Doo95b50.d.ts → researcher-Da0Wj-bt.d.ts} +6 -7
- package/dist/researcher-Da0Wj-bt.d.ts.map +1 -0
- package/dist/{reward-hacking-D-QqXvg-.d.ts → reward-hacking-CQ3hTCO3.d.ts} +2 -2
- package/dist/{reward-hacking-D-QqXvg-.d.ts.map → reward-hacking-CQ3hTCO3.d.ts.map} +1 -1
- package/dist/{reward-hacking-a-kYs0-i.js → reward-hacking-GyN0kMd8.js} +3 -3
- package/dist/{reward-hacking-a-kYs0-i.js.map → reward-hacking-GyN0kMd8.js.map} +1 -1
- package/dist/rl.d.ts +6 -6
- package/dist/rl.js +9 -9
- package/dist/rollout/index.d.ts +1 -1
- package/dist/rollout/index.js +3 -3
- package/dist/{rollout-DLSUIWLu.js → rollout-DQFl0UXA.js} +2 -2
- package/dist/{rollout-DLSUIWLu.js.map → rollout-DQFl0UXA.js.map} +1 -1
- package/dist/{rubric-predictive-validity-BJf-8ejY.js → rubric-predictive-validity-BRR632r1.js} +2 -2
- package/dist/{rubric-predictive-validity-BJf-8ejY.js.map → rubric-predictive-validity-BRR632r1.js.map} +1 -1
- package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts → rubric-predictive-validity-C4sztLR3.d.ts} +2 -2
- package/dist/{rubric-predictive-validity-C1dCLcvb.d.ts.map → rubric-predictive-validity-C4sztLR3.d.ts.map} +1 -1
- package/dist/{run-evidence-DokQtX0-.d.ts → run-evidence-BDIircdA.d.ts} +3 -3
- package/dist/{run-evidence-DokQtX0-.d.ts.map → run-evidence-BDIircdA.d.ts.map} +1 -1
- package/dist/{run-record-DcObtIGh.d.ts → run-record-BPCa2rQ8.d.ts} +4 -4
- package/dist/{run-record-DcObtIGh.d.ts.map → run-record-BPCa2rQ8.d.ts.map} +1 -1
- package/dist/{run-record-BIwU2wdV.js → run-record-vRgqWmJw.js} +3 -3
- package/dist/{run-record-BIwU2wdV.js.map → run-record-vRgqWmJw.js.map} +1 -1
- package/dist/{semantic-concept-judge-Btozx3Vc.js → semantic-concept-judge-Bz64IckK.js} +4 -4
- package/dist/{semantic-concept-judge-Btozx3Vc.js.map → semantic-concept-judge-Bz64IckK.js.map} +1 -1
- package/dist/{server-Bz3WQJs6.js → server-KjXZZUDX.js} +3 -3
- package/dist/{server-Bz3WQJs6.js.map → server-KjXZZUDX.js.map} +1 -1
- package/dist/{skill-usage-BDQVPIG1.d.ts → skill-usage-CFDLLlhF.d.ts} +25 -47
- package/dist/skill-usage-CFDLLlhF.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-CwSYkv35.d.ts → skillopt-optimization-method-BpbnlvAZ.d.ts} +11 -12
- package/dist/skillopt-optimization-method-BpbnlvAZ.d.ts.map +1 -0
- package/dist/{skillopt-optimization-method-0UmPD6aP.js → skillopt-optimization-method-f4o9sUT4.js} +7 -7
- package/dist/{skillopt-optimization-method-0UmPD6aP.js.map → skillopt-optimization-method-f4o9sUT4.js.map} +1 -1
- package/dist/{statistics-CnGCLLqc.js → statistics-ByxzSiOM.js} +2 -2
- package/dist/{statistics-CnGCLLqc.js.map → statistics-ByxzSiOM.js.map} +1 -1
- package/dist/{statistics-CKOqre5S.d.ts → statistics-_7P642CN.d.ts} +2 -2
- package/dist/{statistics-CKOqre5S.d.ts.map → statistics-_7P642CN.d.ts.map} +1 -1
- package/dist/{summary-report-BEk8OFLs.js → summary-report-9A5y7EsK.js} +4 -4
- package/dist/{summary-report-BEk8OFLs.js.map → summary-report-9A5y7EsK.js.map} +1 -1
- package/dist/{summary-report-CPMINBqs.d.ts → summary-report-DHipz9Kx.d.ts} +3 -3
- package/dist/{summary-report-CPMINBqs.d.ts.map → summary-report-DHipz9Kx.d.ts.map} +1 -1
- package/dist/supervisor-run/index.d.ts +3 -2
- package/dist/supervisor-run/index.js +3 -2
- package/dist/{supervisor-run-Dr5HnTup.js → supervisor-run-B2EWUmQY.js} +28 -454
- package/dist/supervisor-run-B2EWUmQY.js.map +1 -0
- package/dist/{test-graded-scenario-BsqWLmPt.js → test-graded-scenario-JHcKQNpq.js} +2 -2
- package/dist/{test-graded-scenario-BsqWLmPt.js.map → test-graded-scenario-JHcKQNpq.js.map} +1 -1
- package/dist/tools-DZk2Jn64.js +1876 -0
- package/dist/tools-DZk2Jn64.js.map +1 -0
- package/dist/traces.d.ts +6 -7
- package/dist/traces.js +5 -6
- package/dist/{types-DVjczBM9.d.ts → types-CKswbJGO.d.ts} +260 -6
- package/dist/types-CKswbJGO.d.ts.map +1 -0
- package/dist/{types-DiWLru6Z.d.ts → types-CTGbIm57.d.ts} +5 -5
- package/dist/{types-DiWLru6Z.d.ts.map → types-CTGbIm57.d.ts.map} +1 -1
- package/dist/types-CTvKfr5F.d.ts +804 -0
- package/dist/types-CTvKfr5F.d.ts.map +1 -0
- package/dist/{index-CyC1BTmn.d.ts → types-Dea6tiVI.d.ts} +16 -238
- package/dist/types-Dea6tiVI.d.ts.map +1 -0
- package/dist/wire/index.d.ts +3 -3
- package/dist/wire/index.js +1 -1
- package/docs/feedback-trajectories.md +100 -1
- package/docs/trace-analysis.md +374 -58
- package/package.json +5 -1
- package/dist/analyst-BkTS3C58.d.ts +0 -89
- package/dist/analyst-BkTS3C58.d.ts.map +0 -1
- package/dist/analyst-j5je5J7c.js +0 -152
- package/dist/analyst-j5je5J7c.js.map +0 -1
- package/dist/campaign-Dz8uQnhC.js.map +0 -1
- package/dist/client-DcvgkaZi.d.ts.map +0 -1
- package/dist/default-registry-Brxr728w.d.ts.map +0 -1
- package/dist/default-registry-CHmdy2An.js.map +0 -1
- package/dist/errors-8YnH8WlF.js.map +0 -1
- package/dist/errors-CEk209JS.d.ts.map +0 -1
- package/dist/feedback-trajectory-CVaeREXV.d.ts.map +0 -1
- package/dist/index-B4Fjfo5U.d.ts.map +0 -1
- package/dist/index-CyC1BTmn.d.ts.map +0 -1
- package/dist/llm-client-BiK4HW0u.d.ts +0 -290
- package/dist/llm-client-BiK4HW0u.d.ts.map +0 -1
- package/dist/raw-provider-sink-BU29Sh8h.d.ts +0 -134
- package/dist/raw-provider-sink-BU29Sh8h.d.ts.map +0 -1
- package/dist/replay-BRfMIs81.d.ts.map +0 -1
- package/dist/replay-C6wRg47C.js.map +0 -1
- package/dist/researcher-Doo95b50.d.ts.map +0 -1
- package/dist/skill-usage-BDQVPIG1.d.ts.map +0 -1
- package/dist/skillopt-optimization-method-CwSYkv35.d.ts.map +0 -1
- package/dist/store-CxJry_cs.d.ts +0 -229
- package/dist/store-CxJry_cs.d.ts.map +0 -1
- package/dist/supervisor-run-Dr5HnTup.js.map +0 -1
- package/dist/tools-D8yTtNSN.js +0 -1190
- package/dist/tools-D8yTtNSN.js.map +0 -1
- package/dist/types-Cc3qbqzj.d.ts +0 -387
- package/dist/types-Cc3qbqzj.d.ts.map +0 -1
- package/dist/types-DVjczBM9.d.ts.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { i as CostLedger } from "./cost-ledger-
|
|
2
|
-
import { f as maximumChargeForLlmRequest, l as costReceiptFromLlm, n as LlmClient, s as callLlm, u as costReceiptFromLlmError } from "./llm-client-
|
|
1
|
+
import { i as CostLedger } from "./cost-ledger-D-5_-dhi.js";
|
|
2
|
+
import { f as maximumChargeForLlmRequest, l as costReceiptFromLlm, n as LlmClient, s as callLlm, u as costReceiptFromLlmError } from "./llm-client-DKB25jV8.js";
|
|
3
3
|
import { LLM_CONTEXT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_OUTPUT_TOKEN_ATTR_KEYS, TOOL_NAME_ATTR_KEYS } from "./trace-attributes.js";
|
|
4
4
|
import { t as executionTrackByLane } from "./execution-tracks-CpgFPpS5.js";
|
|
5
|
-
import {
|
|
5
|
+
import { O as spanEpochMillis, a as runTraceAnalysisLoop, r as buildTraceAnalystTools } from "./tools-DZk2Jn64.js";
|
|
6
6
|
import { c as makeFinding, o as combineAbortSignals } from "./proposal-findings-DCawte-y.js";
|
|
7
|
+
import { t as analyzeSupervisorRunIntegrity } from "./integrity-CCXTftiL.js";
|
|
7
8
|
import { ai } from "@ax-llm/ax";
|
|
8
9
|
import { z } from "zod";
|
|
9
10
|
import { randomUUID } from "node:crypto";
|
|
@@ -134,11 +135,8 @@ function resolveModel(req, defaultModel) {
|
|
|
134
135
|
/**
|
|
135
136
|
* Deterministic behavioral metrics over OTLP spans — pure arithmetic, no LLM.
|
|
136
137
|
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* growth, output decay, tool monoculture, missing self-verification — computed
|
|
140
|
-
* here once, in TypeScript, with zero model judgment. A finding that falls out
|
|
141
|
-
* of arithmetic is trivially model-agnostic and cannot hallucinate the trend.
|
|
138
|
+
* It computes token growth, output decay, tool monoculture, and missing
|
|
139
|
+
* self-verification once in TypeScript with no model judgment.
|
|
142
140
|
*
|
|
143
141
|
* General, not trace-specific: the detectors key off token trajectories and
|
|
144
142
|
* tool usage present in any agentic OTLP trace, not any one benchmark.
|
|
@@ -472,18 +470,9 @@ function everyAdjacent(values, predicate) {
|
|
|
472
470
|
//#endregion
|
|
473
471
|
//#region src/analyst/behavioral-analyst.ts
|
|
474
472
|
/**
|
|
475
|
-
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* context bloat, output decay, tool monoculture, missing self-verification —
|
|
479
|
-
* directly from arithmetic over spans (`computeTraceMetrics`).
|
|
480
|
-
*
|
|
481
|
-
* Why it matters: these findings are model-agnostic BY CONSTRUCTION (no model
|
|
482
|
-
* in the loop), so they cannot return 0 on a weak model the way the Ax-RLM
|
|
483
|
-
* does — and they are strictly more reliable than HALO, which spends tokens
|
|
484
|
-
* re-deriving the same numbers and can hallucinate the trend. The agentic
|
|
485
|
-
* RLM kinds remain for SEMANTIC findings that genuinely need a model; this
|
|
486
|
-
* analyst owns the behavioral class.
|
|
473
|
+
* Deterministic behavioral analysis over arithmetic in trace spans.
|
|
474
|
+
* This pass is cheap and repeatable; semantic analysis remains the job of
|
|
475
|
+
* model-backed analysts. Relative quality requires a labeled comparison.
|
|
487
476
|
*/
|
|
488
477
|
const RECOMMENDED_ACTION = {
|
|
489
478
|
"monotonic-input-growth": "Inspect context assembly; if prior history is repeatedly included, summarize completed work before the next model call.",
|
|
@@ -491,19 +480,44 @@ const RECOMMENDED_ACTION = {
|
|
|
491
480
|
"single-tool-dependency": "Test whether an inspect or verification tool improves outcomes after the repeated call fails or returns no progress.",
|
|
492
481
|
"no-self-verification": "After state-changing actions, require an observable check before the agent proceeds."
|
|
493
482
|
};
|
|
494
|
-
const ANALYST_ID = "efficiency-behavioral";
|
|
483
|
+
const ANALYST_ID$1 = "efficiency-behavioral";
|
|
484
|
+
const DEFAULT_MAX_TRACES = 1e3;
|
|
485
|
+
const DEFAULT_MAX_EVIDENCE_REFS = 20;
|
|
486
|
+
const TRACE_PAGE_SIZE = 200;
|
|
495
487
|
const AGGREGATE_CLAIM = {
|
|
496
488
|
"monotonic-input-growth": (observed, analyzed) => `${observed}/${analyzed} analyzed traces showed input tokens grow from zero to nonzero or to at least 3x their initial value across at least 3 serial model calls without a decrease.`,
|
|
497
489
|
"output-length-decay": (observed, analyzed) => `${observed}/${analyzed} analyzed traces showed output tokens decrease while input tokens increased monotonically across at least 3 serial model calls.`,
|
|
498
490
|
"single-tool-dependency": (observed, analyzed) => `${observed}/${analyzed} analyzed traces used only one named tool across at least 3 tool calls.`,
|
|
499
491
|
"no-self-verification": (observed, analyzed) => `${observed}/${analyzed} analyzed traces had at least 3 tool calls without a verification-named tool call.`
|
|
500
492
|
};
|
|
493
|
+
async function listTraceIds(store, maxTraces, signal) {
|
|
494
|
+
const traceIds = /* @__PURE__ */ new Set();
|
|
495
|
+
let offset = 0;
|
|
496
|
+
let expectedTotal;
|
|
497
|
+
while (true) {
|
|
498
|
+
signal?.throwIfAborted();
|
|
499
|
+
const page = await store.queryTraces({
|
|
500
|
+
limit: TRACE_PAGE_SIZE,
|
|
501
|
+
offset
|
|
502
|
+
});
|
|
503
|
+
if (expectedTotal === void 0) expectedTotal = page.total;
|
|
504
|
+
if (page.total !== expectedTotal) throw new Error(`behavioralAnalyst: trace count changed during pagination (${expectedTotal} to ${page.total})`);
|
|
505
|
+
if (page.total > maxTraces) throw new RangeError(`behavioralAnalyst: ${page.total} traces exceed maxTraces=${maxTraces}; filter the store or raise the explicit limit`);
|
|
506
|
+
for (const trace of page.traces) traceIds.add(trace.trace_id);
|
|
507
|
+
if (traceIds.size > maxTraces) throw new RangeError(`behavioralAnalyst: more than maxTraces=${maxTraces} unique traces were returned`);
|
|
508
|
+
if (!page.has_more) break;
|
|
509
|
+
if (page.traces.length === 0) throw new Error("behavioralAnalyst: trace store returned an empty page with has_more=true");
|
|
510
|
+
offset += page.traces.length;
|
|
511
|
+
}
|
|
512
|
+
if (traceIds.size !== expectedTotal) throw new Error(`behavioralAnalyst: pagination returned ${traceIds.size}/${expectedTotal ?? 0} unique traces`);
|
|
513
|
+
return [...traceIds].sort();
|
|
514
|
+
}
|
|
501
515
|
/**
|
|
502
516
|
* Map computed signals → structured AnalystFindings. Pure: no LLM, no clock
|
|
503
517
|
* dependence beyond `produced_at` (overridable for deterministic tests).
|
|
504
518
|
*/
|
|
505
519
|
function deriveEfficiencyFindings(metrics, opts = {}) {
|
|
506
|
-
const analystId = opts.analystId ?? ANALYST_ID;
|
|
520
|
+
const analystId = opts.analystId ?? ANALYST_ID$1;
|
|
507
521
|
const traceId = metrics.traceId;
|
|
508
522
|
return metrics.signals.map((sig) => makeFinding({
|
|
509
523
|
analyst_id: analystId,
|
|
@@ -528,18 +542,20 @@ function deriveEfficiencyFindings(metrics, opts = {}) {
|
|
|
528
542
|
}));
|
|
529
543
|
}
|
|
530
544
|
/** The deterministic behavioral/efficiency analyst (no LLM, any-model). */
|
|
531
|
-
function behavioralAnalyst() {
|
|
545
|
+
function behavioralAnalyst(options = {}) {
|
|
546
|
+
const maxTraces = positiveInteger(options.maxTraces ?? DEFAULT_MAX_TRACES, "maxTraces");
|
|
547
|
+
const maxEvidenceRefsPerFinding = positiveInteger(options.maxEvidenceRefsPerFinding ?? DEFAULT_MAX_EVIDENCE_REFS, "maxEvidenceRefsPerFinding");
|
|
532
548
|
return {
|
|
533
|
-
id: ANALYST_ID,
|
|
549
|
+
id: ANALYST_ID$1,
|
|
534
550
|
description: "Deterministic behavioral/efficiency findings over OTLP spans — token-growth, output-decay, tool-monoculture, missing self-verification. Zero LLM; model-agnostic by construction.",
|
|
535
551
|
inputKind: "trace-store",
|
|
536
552
|
cost: { kind: "deterministic" },
|
|
537
553
|
version: "2.0.0",
|
|
538
|
-
async analyze(store) {
|
|
539
|
-
const
|
|
540
|
-
const analyzedTraceIds = [...new Set(overview.sample_trace_ids)].sort();
|
|
554
|
+
async analyze(store, context) {
|
|
555
|
+
const analyzedTraceIds = await listTraceIds(store, maxTraces, context.signal);
|
|
541
556
|
const findingsById = /* @__PURE__ */ new Map();
|
|
542
557
|
for (const traceId of analyzedTraceIds) {
|
|
558
|
+
context.signal?.throwIfAborted();
|
|
543
559
|
const viewed = await store.viewTrace({ trace_id: traceId });
|
|
544
560
|
if (viewed.trace_id !== traceId) throw new Error(`behavioralAnalyst: requested trace '${traceId}', received '${viewed.trace_id}'`);
|
|
545
561
|
if (!viewed.spans) throw new Error(`behavioralAnalyst: trace '${traceId}' is oversized; complete spans are required`);
|
|
@@ -550,30 +566,39 @@ function behavioralAnalyst() {
|
|
|
550
566
|
if (!current) {
|
|
551
567
|
findingsById.set(finding.finding_id, {
|
|
552
568
|
finding,
|
|
553
|
-
|
|
569
|
+
observedTraceCount: 1,
|
|
570
|
+
evidenceTraceIds: [traceId],
|
|
554
571
|
evidence: [...finding.evidence_refs]
|
|
555
572
|
});
|
|
556
573
|
continue;
|
|
557
574
|
}
|
|
558
|
-
current.
|
|
559
|
-
current.evidence.
|
|
575
|
+
current.observedTraceCount += 1;
|
|
576
|
+
if (current.evidence.length < maxEvidenceRefsPerFinding) {
|
|
577
|
+
current.evidenceTraceIds.push(traceId);
|
|
578
|
+
current.evidence.push(...finding.evidence_refs);
|
|
579
|
+
}
|
|
560
580
|
}
|
|
561
581
|
}
|
|
562
|
-
return [...findingsById.values()].map(({ finding,
|
|
582
|
+
return [...findingsById.values()].map(({ finding, observedTraceCount, evidenceTraceIds, evidence }) => ({
|
|
563
583
|
...finding,
|
|
564
|
-
claim: AGGREGATE_CLAIM[finding.subject](
|
|
565
|
-
rationale: `${
|
|
584
|
+
claim: AGGREGATE_CLAIM[finding.subject](observedTraceCount, analyzedTraceIds.length),
|
|
585
|
+
rationale: `${observedTraceCount}/${analyzedTraceIds.length} analyzed traces exhibited this pattern.`,
|
|
566
586
|
evidence_refs: evidence,
|
|
567
587
|
metadata: {
|
|
568
588
|
deterministic: true,
|
|
569
|
-
|
|
570
|
-
|
|
589
|
+
evidence_trace_ids: evidenceTraceIds,
|
|
590
|
+
omitted_evidence_trace_count: observedTraceCount - evidenceTraceIds.length,
|
|
591
|
+
observed_trace_count: observedTraceCount,
|
|
571
592
|
analyzed_trace_count: analyzedTraceIds.length
|
|
572
593
|
}
|
|
573
594
|
}));
|
|
574
595
|
}
|
|
575
596
|
};
|
|
576
597
|
}
|
|
598
|
+
function positiveInteger(value, name) {
|
|
599
|
+
if (!Number.isSafeInteger(value) || value < 1) throw new RangeError(`behavioralAnalyst: ${name} must be a positive safe integer`);
|
|
600
|
+
return value;
|
|
601
|
+
}
|
|
577
602
|
//#endregion
|
|
578
603
|
//#region src/analyst/ax-cost-service.ts
|
|
579
604
|
/**
|
|
@@ -1719,6 +1744,62 @@ function truncateForContext(s, max) {
|
|
|
1719
1744
|
return `${s.slice(0, max - 1).trimEnd()}…`;
|
|
1720
1745
|
}
|
|
1721
1746
|
//#endregion
|
|
1747
|
+
//#region src/analyst/kinds/control-integrity.ts
|
|
1748
|
+
const ANALYST_ID = "control-integrity";
|
|
1749
|
+
function shown(value) {
|
|
1750
|
+
if (value === void 0) return "<absent>";
|
|
1751
|
+
const encoded = JSON.stringify(value);
|
|
1752
|
+
return encoded === void 0 ? String(value) : encoded;
|
|
1753
|
+
}
|
|
1754
|
+
function evidenceRef(namespace, value) {
|
|
1755
|
+
return {
|
|
1756
|
+
kind: "metric",
|
|
1757
|
+
uri: `supervisor-run://${encodeURIComponent(namespace)}/${value.path}`,
|
|
1758
|
+
excerpt: shown(value.value)
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
/** Translate typed supervisor-run integrity issues into the shared analyst envelope. */
|
|
1762
|
+
function emitControlIntegrityFindings(input, producedAt) {
|
|
1763
|
+
const report = analyzeSupervisorRunIntegrity(input, { capturedAt: producedAt });
|
|
1764
|
+
return report.issues.map((issue) => makeFinding({
|
|
1765
|
+
analyst_id: ANALYST_ID,
|
|
1766
|
+
produced_at: producedAt,
|
|
1767
|
+
area: issue.area,
|
|
1768
|
+
severity: issue.severity,
|
|
1769
|
+
subject: `${report.runRef}/${issue.subject}`,
|
|
1770
|
+
claim: issue.claim,
|
|
1771
|
+
rationale: issue.detail,
|
|
1772
|
+
evidence_refs: issue.evidence.map((value) => evidenceRef(report.runRef, value)),
|
|
1773
|
+
recommended_action: issue.recommendedAction,
|
|
1774
|
+
validation_plan: "Re-run this deterministic analyst on the retained SupervisorRunSources or SupervisorRunTree after correcting the producer.",
|
|
1775
|
+
confidence: 1,
|
|
1776
|
+
metadata: {
|
|
1777
|
+
integrity_code: issue.code,
|
|
1778
|
+
integrity_input: report.input,
|
|
1779
|
+
integrity_run_ref: report.runRef,
|
|
1780
|
+
integrity_subject: issue.subject,
|
|
1781
|
+
...issue.metadata
|
|
1782
|
+
}
|
|
1783
|
+
}));
|
|
1784
|
+
}
|
|
1785
|
+
/** Deterministic Analyst adapter for `SupervisorRunSources | SupervisorRunTree`. */
|
|
1786
|
+
var ControlIntegrityAnalyst = class {
|
|
1787
|
+
id = ANALYST_ID;
|
|
1788
|
+
description = "Deterministic supervisor-run integrity checks with explicit unavailable evidence.";
|
|
1789
|
+
inputKind = "custom";
|
|
1790
|
+
cost = {
|
|
1791
|
+
kind: "deterministic",
|
|
1792
|
+
est_usd_per_run: 0
|
|
1793
|
+
};
|
|
1794
|
+
version = "2.0.0";
|
|
1795
|
+
async analyze(input, ctx) {
|
|
1796
|
+
const findings = emitControlIntegrityFindings(input, ctx.tags?.producedAt ?? (/* @__PURE__ */ new Date()).toISOString());
|
|
1797
|
+
ctx.log?.(`control-integrity: ${findings.length} finding(s)`, { input: "nodes" in input ? "SupervisorRunTree" : "SupervisorRunSources" });
|
|
1798
|
+
return findings;
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
const CONTROL_INTEGRITY_ANALYST = new ControlIntegrityAnalyst();
|
|
1802
|
+
//#endregion
|
|
1722
1803
|
//#region src/analyst/tool-groups.ts
|
|
1723
1804
|
const TOOL_NAMES_BY_GROUP = {
|
|
1724
1805
|
all: /* @__PURE__ */ new Set(),
|
|
@@ -2497,7 +2578,7 @@ function selectPriorFindings(source, analystId) {
|
|
|
2497
2578
|
//#region src/analyst/default-registry.ts
|
|
2498
2579
|
function buildDefaultAnalystRegistry(opts = {}) {
|
|
2499
2580
|
const registry = new AnalystRegistry(opts.registry);
|
|
2500
|
-
if (opts.includeBehavioral !== false) registry.register(behavioralAnalyst());
|
|
2581
|
+
if (opts.includeBehavioral !== false) registry.register(behavioralAnalyst(opts.behavioral));
|
|
2501
2582
|
if (opts.ai) {
|
|
2502
2583
|
const kinds = opts.kinds ?? DEFAULT_TRACE_ANALYST_KINDS;
|
|
2503
2584
|
for (const spec of kinds) registry.register(createTraceAnalystKind(spec, {
|
|
@@ -2508,6 +2589,6 @@ function buildDefaultAnalystRegistry(opts = {}) {
|
|
|
2508
2589
|
return registry;
|
|
2509
2590
|
}
|
|
2510
2591
|
//#endregion
|
|
2511
|
-
export {
|
|
2592
|
+
export { FindingSubjectStringSchema as A, parseRawFinding as C, FINDING_SUBJECT_GRAMMAR_PROMPT as D, stripCodeFences as E, behavioralAnalyst as F, deriveEfficiencyFindings as I, computeTraceMetrics as L, findingSubjectGrammarPromptFor as M, parseFindingSubject as N, FINDING_SUBJECT_KINDS as O, renderFindingSubject as P, createChatClient as R, evidenceRefsFromRawFinding as S, coerceToFindingRows as T, structureFindings as _, KNOWLEDGE_GAP_KIND_SPEC as a, RawAnalystEvidenceSchema as b, buildTraceToolsForGroup as c, emitControlIntegrityFindings as d, createTraceAnalystKind as f, validateUsageSettlementTimeout as g, settleUsageReceiptFromCostLedger as h, KNOWLEDGE_POISONING_KIND_SPEC as i, KIND_EXPECTED_SUBJECTS as j, FINDING_SUBJECT_SYNTAX as k, CONTROL_INTEGRITY_ANALYST as l, renderUpstreamFindings as m, AnalystRegistry as n, IMPROVEMENT_KIND_SPEC as o, renderPriorFindings as p, DEFAULT_TRACE_ANALYST_KINDS as r, FAILURE_MODE_KIND_SPEC as s, buildDefaultAnalystRegistry as t, ControlIntegrityAnalyst as u, ANALYST_SEVERITIES as v, coerceJson as w, RawAnalystFindingSchema as x, RAW_FINDING_SCHEMA_PROMPT as y, createAnalystAi as z };
|
|
2512
2593
|
|
|
2513
|
-
//# sourceMappingURL=default-registry-
|
|
2594
|
+
//# sourceMappingURL=default-registry-CLXbRt0f.js.map
|