@tangle-network/agent-eval 0.118.1 → 0.118.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/analyst/index.d.ts +10 -3
  3. package/dist/analyst/index.js +6 -6
  4. package/dist/benchmarks/index.js +9 -9
  5. package/dist/campaign/index.d.ts +22 -15
  6. package/dist/campaign/index.js +8 -8
  7. package/dist/{chunk-33JA4TFA.js → chunk-267UCQWI.js} +10 -5
  8. package/dist/chunk-267UCQWI.js.map +1 -0
  9. package/dist/{chunk-QKEGNI5B.js → chunk-6QIM2EAP.js} +6 -116
  10. package/dist/chunk-6QIM2EAP.js.map +1 -0
  11. package/dist/{chunk-SVH2ANFD.js → chunk-7V3QDWNL.js} +2 -2
  12. package/dist/{chunk-IDZTTFRR.js → chunk-EGNRE7VA.js} +2 -2
  13. package/dist/chunk-EGNRE7VA.js.map +1 -0
  14. package/dist/{chunk-Q442S5AS.js → chunk-EKHHBKS6.js} +7 -7
  15. package/dist/chunk-EKHHBKS6.js.map +1 -0
  16. package/dist/{chunk-BFW56GTT.js → chunk-F5A4GDQW.js} +3 -3
  17. package/dist/{chunk-BFW56GTT.js.map → chunk-F5A4GDQW.js.map} +1 -1
  18. package/dist/{chunk-3EHHMC6E.js → chunk-FIUFRXP3.js} +2 -2
  19. package/dist/{chunk-KSDQVPLR.js → chunk-H5UD2323.js} +2 -2
  20. package/dist/{chunk-LTVG32KX.js → chunk-JTMFT5QZ.js} +2 -2
  21. package/dist/chunk-JTMFT5QZ.js.map +1 -0
  22. package/dist/chunk-K4DBDHLK.js +158 -0
  23. package/dist/chunk-K4DBDHLK.js.map +1 -0
  24. package/dist/{chunk-JSDVRFAP.js → chunk-KK2O4VWA.js} +2 -2
  25. package/dist/{chunk-VCTY3W6J.js → chunk-MLHRFWQK.js} +1 -1
  26. package/dist/chunk-MLHRFWQK.js.map +1 -0
  27. package/dist/{chunk-YLMUS4MM.js → chunk-QWRLW4CT.js} +5 -5
  28. package/dist/chunk-QWRLW4CT.js.map +1 -0
  29. package/dist/{chunk-OIIMMLRB.js → chunk-VNLWDTDA.js} +3 -3
  30. package/dist/chunk-VNLWDTDA.js.map +1 -0
  31. package/dist/{chunk-FTUMG2U7.js → chunk-ZYHJNKI3.js} +11 -40
  32. package/dist/chunk-ZYHJNKI3.js.map +1 -0
  33. package/dist/cli.js +2 -2
  34. package/dist/contract/index.d.ts +17 -10
  35. package/dist/contract/index.js +11 -11
  36. package/dist/contract/index.js.map +1 -1
  37. package/dist/fuzz.d.ts +8 -1
  38. package/dist/fuzz.js +1 -1
  39. package/dist/fuzz.js.map +1 -1
  40. package/dist/index.d.ts +51 -24
  41. package/dist/index.js +33 -27
  42. package/dist/index.js.map +1 -1
  43. package/dist/openapi.json +1 -1
  44. package/dist/{run-campaign-IM26A6PD.js → run-campaign-DWC67KJP.js} +3 -3
  45. package/dist/trace-attributes.d.ts +37 -1
  46. package/dist/trace-attributes.js +33 -3
  47. package/dist/traces.d.ts +28 -8
  48. package/dist/traces.js +24 -18
  49. package/dist/wire/index.d.ts +8 -1
  50. package/dist/wire/index.js +2 -2
  51. package/package.json +1 -1
  52. package/dist/chunk-33JA4TFA.js.map +0 -1
  53. package/dist/chunk-FTUMG2U7.js.map +0 -1
  54. package/dist/chunk-IDZTTFRR.js.map +0 -1
  55. package/dist/chunk-LTVG32KX.js.map +0 -1
  56. package/dist/chunk-OIIMMLRB.js.map +0 -1
  57. package/dist/chunk-Q442S5AS.js.map +0 -1
  58. package/dist/chunk-QKEGNI5B.js.map +0 -1
  59. package/dist/chunk-VCTY3W6J.js.map +0 -1
  60. package/dist/chunk-WDHBCA3M.js +0 -31
  61. package/dist/chunk-WDHBCA3M.js.map +0 -1
  62. package/dist/chunk-YLMUS4MM.js.map +0 -1
  63. /package/dist/{chunk-SVH2ANFD.js.map → chunk-7V3QDWNL.js.map} +0 -0
  64. /package/dist/{chunk-3EHHMC6E.js.map → chunk-FIUFRXP3.js.map} +0 -0
  65. /package/dist/{chunk-KSDQVPLR.js.map → chunk-H5UD2323.js.map} +0 -0
  66. /package/dist/{chunk-JSDVRFAP.js.map → chunk-KK2O4VWA.js.map} +0 -0
  67. /package/dist/{run-campaign-IM26A6PD.js.map → run-campaign-DWC67KJP.js.map} +0 -0
package/dist/openapi.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "openapi": "3.1.0",
3
3
  "info": {
4
4
  "title": "@tangle-network/agent-eval — wire protocol",
5
- "version": "0.118.1",
5
+ "version": "0.118.3",
6
6
  "description": "HTTP and stdio RPC interface to agent-eval. The TypeScript runtime is the source of truth; this spec is the contract that cross-language clients (Python, Rust, Go) generate from.\n\nWire-protocol version: 1.0.0. Bumps on breaking changes to request/response schemas.",
7
7
  "contact": {
8
8
  "name": "Tangle Network",
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  planCampaignRun,
3
3
  runCampaign
4
- } from "./chunk-IDZTTFRR.js";
4
+ } from "./chunk-EGNRE7VA.js";
5
5
  import "./chunk-PJQFMIOX.js";
6
- import "./chunk-VCTY3W6J.js";
6
+ import "./chunk-MLHRFWQK.js";
7
7
  import "./chunk-VI2UW6B6.js";
8
8
  import "./chunk-ONWEPEDO.js";
9
9
  import "./chunk-PZ5AY32C.js";
@@ -11,4 +11,4 @@ export {
11
11
  planCampaignRun,
12
12
  runCampaign
13
13
  };
14
- //# sourceMappingURL=run-campaign-IM26A6PD.js.map
14
+ //# sourceMappingURL=run-campaign-DWC67KJP.js.map
@@ -6,11 +6,47 @@ declare const LLM_OUTPUT_TOKENS = "llm.token_count.completion";
6
6
  declare const LLM_REASONING_TOKENS = "llm.token_count.reasoning";
7
7
  declare const LLM_CACHED_TOKENS = "llm.token_count.prompt_cache_hit";
8
8
  declare const LLM_CACHE_WRITE_TOKENS = "llm.token_count.prompt_cache_write";
9
+ /** Exact prompt context after summing mutually exclusive input/cache categories. */
10
+ declare const LLM_CONTEXT_TOKENS = "tangle.llm.context_tokens";
9
11
  declare const LLM_COST_USD = "llm.cost_usd";
10
12
  declare const TOOL_NAME = "tool.name";
11
13
  declare const TOOL_ARGS_CAPTURED = "tool.args_captured";
12
14
  declare const TOOL_LATENCY_MS = "tool.latency_ms";
13
15
  declare const INPUT_VALUE = "input.value";
14
16
  declare const OUTPUT_VALUE = "output.value";
17
+ declare const SPAN_KIND_ATTR_KEYS: readonly ["openinference.span.kind", "inference.observation_kind"];
18
+ declare const LLM_MODEL_ATTR_KEYS: readonly ["llm.model_name", "inference.llm.model_name", "llm.model", ...string[], "tangle.model"];
19
+ declare const LLM_INPUT_TOKEN_ATTR_KEYS: readonly ["llm.token_count.prompt", "inference.llm.input_tokens", "llm.input_tokens", ...string[], "tangle.tokens.in", "tokens.in"];
20
+ declare const LLM_OUTPUT_TOKEN_ATTR_KEYS: readonly ["llm.token_count.completion", "inference.llm.output_tokens", "llm.output_tokens", ...string[], "tangle.tokens.out", "tokens.out"];
21
+ /** Reasoning-token subset of output, when a producer exposes it separately. */
22
+ declare const LLM_REASONING_TOKEN_ATTR_KEYS: readonly ["llm.token_count.reasoning", "inference.llm.reasoning_tokens", "llm.reasoning_tokens", "gen_ai.usage.reasoning_tokens", "gen_ai.usage.reasoning_output_tokens", "reasoning_tokens", "reasoning_output_tokens", "tangle.tokens.reasoning", "gen_ai.usage.output_tokens_details.reasoning_tokens", "gen_ai.usage.completion_tokens_details.reasoning_tokens"];
23
+ declare const LLM_CACHED_TOKEN_ATTR_KEYS: readonly ["llm.token_count.prompt_cache_hit", "inference.llm.cached_tokens", "llm.cached_tokens", "gen_ai.usage.cached_tokens", "gen_ai.usage.prompt_tokens_details.cached_tokens", "gen_ai.usage.input_tokens_details.cached_tokens", "gen_ai.usage.cache_read_tokens", "gen_ai.usage.cache_read_input_tokens", "cache_read_tokens", "cache_read_input_tokens", "input_cache_read", "tangle.tokens.cached"];
24
+ declare const LLM_CACHE_WRITE_TOKEN_ATTR_KEYS: readonly ["llm.token_count.prompt_cache_write", "inference.llm.cache_write_tokens", "llm.cache_write_tokens", "gen_ai.usage.cache_creation_tokens", "gen_ai.usage.cache_creation_input_tokens", "cache_creation_tokens", "cache_creation_input_tokens", "input_cache_creation", "tangle.tokens.cache_write"];
25
+ declare const LLM_COST_ATTR_KEYS: readonly ["llm.cost_usd", "inference.llm.cost.total", "llm.cost.total", "gen_ai.usage.cost", "gen_ai.usage.cost_usd", "tangle.cost.usd", "cost.usd", "cost"];
26
+ /** Explicit run-total cost keys safe to preserve on an untyped span. */
27
+ declare const RUN_COST_ATTR_KEYS: readonly ["tangle.cost.usd", "cost.usd"];
28
+ declare const TOOL_NAME_ATTR_KEYS: readonly ["tool.name", "inference.tool.name"];
29
+ /** Read a numeric attribute, tolerating numeric strings; `null` if absent or invalid. */
30
+ declare function asNumber(value: unknown): number | null;
31
+ /** First finite numeric value across a list of candidate attribute keys. */
32
+ declare function firstNumberAttr(attributes: Record<string, unknown>, keys: readonly string[]): number | null;
33
+ /** Sum producer-supplied, mutually exclusive prompt-token categories. */
34
+ declare function contextInputTokens(usage: {
35
+ inputTokens?: number | null;
36
+ cachedTokens?: number | null;
37
+ cacheWriteTokens?: number | null;
38
+ }): number | undefined;
39
+ interface LlmSpanOtlpInput {
40
+ model?: string;
41
+ inputTokens?: number;
42
+ outputTokens?: number;
43
+ reasoningTokens?: number;
44
+ cachedTokens?: number;
45
+ cacheWriteTokens?: number;
46
+ costUsd?: number;
47
+ finishReason?: string;
48
+ }
49
+ /** Write the canonical LLM attributes shared by trace producers. */
50
+ declare function applyLlmSpanOtlpAttributes(attributes: Record<string, unknown>, span: LlmSpanOtlpInput): void;
15
51
 
16
- export { INPUT_VALUE, LLM_CACHED_TOKENS, LLM_CACHE_WRITE_TOKENS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_REASONING_TOKENS, OPENINFERENCE_SPAN_KIND, OUTPUT_VALUE, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME };
52
+ export { INPUT_VALUE, LLM_CACHED_TOKENS, LLM_CACHED_TOKEN_ATTR_KEYS, LLM_CACHE_WRITE_TOKENS, LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, LLM_CONTEXT_TOKENS, LLM_COST_ATTR_KEYS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_MODEL_ATTR_KEYS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_OUTPUT_TOKEN_ATTR_KEYS, LLM_REASONING_TOKENS, LLM_REASONING_TOKEN_ATTR_KEYS, type LlmSpanOtlpInput, OPENINFERENCE_SPAN_KIND, OUTPUT_VALUE, RUN_COST_ATTR_KEYS, SPAN_KIND_ATTR_KEYS, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME, TOOL_NAME_ATTR_KEYS, applyLlmSpanOtlpAttributes, asNumber, contextInputTokens, firstNumberAttr };
@@ -1,32 +1,62 @@
1
1
  import {
2
2
  INPUT_VALUE,
3
3
  LLM_CACHED_TOKENS,
4
+ LLM_CACHED_TOKEN_ATTR_KEYS,
4
5
  LLM_CACHE_WRITE_TOKENS,
6
+ LLM_CACHE_WRITE_TOKEN_ATTR_KEYS,
7
+ LLM_CONTEXT_TOKENS,
8
+ LLM_COST_ATTR_KEYS,
5
9
  LLM_COST_USD,
6
10
  LLM_INPUT_TOKENS,
11
+ LLM_INPUT_TOKEN_ATTR_KEYS,
12
+ LLM_MODEL_ATTR_KEYS,
7
13
  LLM_MODEL_NAME,
8
14
  LLM_OUTPUT_TOKENS,
15
+ LLM_OUTPUT_TOKEN_ATTR_KEYS,
9
16
  LLM_REASONING_TOKENS,
17
+ LLM_REASONING_TOKEN_ATTR_KEYS,
10
18
  OPENINFERENCE_SPAN_KIND,
11
19
  OUTPUT_VALUE,
20
+ RUN_COST_ATTR_KEYS,
21
+ SPAN_KIND_ATTR_KEYS,
12
22
  TOOL_ARGS_CAPTURED,
13
23
  TOOL_LATENCY_MS,
14
- TOOL_NAME
15
- } from "./chunk-WDHBCA3M.js";
24
+ TOOL_NAME,
25
+ TOOL_NAME_ATTR_KEYS,
26
+ applyLlmSpanOtlpAttributes,
27
+ asNumber,
28
+ contextInputTokens,
29
+ firstNumberAttr
30
+ } from "./chunk-K4DBDHLK.js";
16
31
  import "./chunk-PZ5AY32C.js";
17
32
  export {
18
33
  INPUT_VALUE,
19
34
  LLM_CACHED_TOKENS,
35
+ LLM_CACHED_TOKEN_ATTR_KEYS,
20
36
  LLM_CACHE_WRITE_TOKENS,
37
+ LLM_CACHE_WRITE_TOKEN_ATTR_KEYS,
38
+ LLM_CONTEXT_TOKENS,
39
+ LLM_COST_ATTR_KEYS,
21
40
  LLM_COST_USD,
22
41
  LLM_INPUT_TOKENS,
42
+ LLM_INPUT_TOKEN_ATTR_KEYS,
43
+ LLM_MODEL_ATTR_KEYS,
23
44
  LLM_MODEL_NAME,
24
45
  LLM_OUTPUT_TOKENS,
46
+ LLM_OUTPUT_TOKEN_ATTR_KEYS,
25
47
  LLM_REASONING_TOKENS,
48
+ LLM_REASONING_TOKEN_ATTR_KEYS,
26
49
  OPENINFERENCE_SPAN_KIND,
27
50
  OUTPUT_VALUE,
51
+ RUN_COST_ATTR_KEYS,
52
+ SPAN_KIND_ATTR_KEYS,
28
53
  TOOL_ARGS_CAPTURED,
29
54
  TOOL_LATENCY_MS,
30
- TOOL_NAME
55
+ TOOL_NAME,
56
+ TOOL_NAME_ATTR_KEYS,
57
+ applyLlmSpanOtlpAttributes,
58
+ asNumber,
59
+ contextInputTokens,
60
+ firstNumberAttr
31
61
  };
32
62
  //# sourceMappingURL=trace-attributes.js.map
package/dist/traces.d.ts CHANGED
@@ -1192,15 +1192,14 @@ declare const LLM_OUTPUT_TOKENS = "llm.token_count.completion";
1192
1192
  declare const LLM_REASONING_TOKENS = "llm.token_count.reasoning";
1193
1193
  declare const LLM_CACHED_TOKENS = "llm.token_count.prompt_cache_hit";
1194
1194
  declare const LLM_CACHE_WRITE_TOKENS = "llm.token_count.prompt_cache_write";
1195
+ /** Exact prompt context after summing mutually exclusive input/cache categories. */
1196
+ declare const LLM_CONTEXT_TOKENS = "tangle.llm.context_tokens";
1195
1197
  declare const LLM_COST_USD = "llm.cost_usd";
1196
1198
  declare const TOOL_NAME = "tool.name";
1197
1199
  declare const TOOL_ARGS_CAPTURED = "tool.args_captured";
1198
1200
  declare const TOOL_LATENCY_MS = "tool.latency_ms";
1199
1201
  declare const INPUT_VALUE = "input.value";
1200
1202
  declare const OUTPUT_VALUE = "output.value";
1201
-
1202
- /** Canonical OpenInference-over-OTLP attribute vocabulary used at the trace boundary. */
1203
-
1204
1203
  declare const SPAN_KIND_ATTR_KEYS: readonly ["openinference.span.kind", "inference.observation_kind"];
1205
1204
  declare const LLM_MODEL_ATTR_KEYS: readonly ["llm.model_name", "inference.llm.model_name", "llm.model", ...string[], "tangle.model"];
1206
1205
  declare const LLM_INPUT_TOKEN_ATTR_KEYS: readonly ["llm.token_count.prompt", "inference.llm.input_tokens", "llm.input_tokens", ...string[], "tangle.tokens.in", "tokens.in"];
@@ -1213,6 +1212,31 @@ declare const LLM_COST_ATTR_KEYS: readonly ["llm.cost_usd", "inference.llm.cost.
1213
1212
  /** Explicit run-total cost keys safe to preserve on an untyped span. */
1214
1213
  declare const RUN_COST_ATTR_KEYS: readonly ["tangle.cost.usd", "cost.usd"];
1215
1214
  declare const TOOL_NAME_ATTR_KEYS: readonly ["tool.name", "inference.tool.name"];
1215
+ /** Read a numeric attribute, tolerating numeric strings; `null` if absent or invalid. */
1216
+ declare function asNumber(value: unknown): number | null;
1217
+ /** First finite numeric value across a list of candidate attribute keys. */
1218
+ declare function firstNumberAttr(attributes: Record<string, unknown>, keys: readonly string[]): number | null;
1219
+ /** Sum producer-supplied, mutually exclusive prompt-token categories. */
1220
+ declare function contextInputTokens(usage: {
1221
+ inputTokens?: number | null;
1222
+ cachedTokens?: number | null;
1223
+ cacheWriteTokens?: number | null;
1224
+ }): number | undefined;
1225
+ interface LlmSpanOtlpInput {
1226
+ model?: string;
1227
+ inputTokens?: number;
1228
+ outputTokens?: number;
1229
+ reasoningTokens?: number;
1230
+ cachedTokens?: number;
1231
+ cacheWriteTokens?: number;
1232
+ costUsd?: number;
1233
+ finishReason?: string;
1234
+ }
1235
+ /** Write the canonical LLM attributes shared by trace producers. */
1236
+ declare function applyLlmSpanOtlpAttributes(attributes: Record<string, unknown>, span: LlmSpanOtlpInput): void;
1237
+
1238
+ /** Canonical OpenInference-over-OTLP attribute vocabulary used at the trace boundary. */
1239
+
1216
1240
  type ToolSpanOtlpInput = Pick<ToolSpan, 'toolName' | 'args' | 'argsCaptured' | 'result' | 'latencyMs'>;
1217
1241
  declare function applyToolSpanOtlpAttributes(attributes: Record<string, unknown>, span: ToolSpanOtlpInput): void;
1218
1242
  declare function traceSpanKindToOpenInferenceKind(kind: string): string;
@@ -2012,10 +2036,6 @@ declare function inferOtlpKind(attrs: Record<string, unknown>): TraceAnalystSpan
2012
2036
  declare function extractOtlpAttributes(raw: Record<string, unknown>): Record<string, unknown>;
2013
2037
  declare function stringField(raw: Record<string, unknown>, key: string): string | undefined;
2014
2038
  declare function asString(v: unknown): string | null;
2015
- /** Read a numeric attribute, tolerating numeric strings; `null` if absent/NaN. */
2016
- declare function asNumber(v: unknown): number | null;
2017
- /** First finite numeric value across a list of candidate attribute keys. */
2018
- declare function firstNumberAttr(attrs: Record<string, unknown>, keys: readonly string[]): number | null;
2019
2039
  /** First non-empty string value across a list of candidate attribute keys. */
2020
2040
  declare function firstStringAttr(attrs: Record<string, unknown>, keys: readonly string[]): string | null;
2021
2041
 
@@ -2306,4 +2326,4 @@ declare function traceAnalystFunctionGroup(opts: BuildTraceAnalystToolsOpts): {
2306
2326
  functions: AxFunction[];
2307
2327
  };
2308
2328
 
2309
- export { type AnalyzeTracesInput, type AnalyzeTracesOptions, type AnalyzeTracesResult, type AnalyzeTracesTurnSnapshot, type Artifact, type BudgetLedgerEntry, type BudgetSpec, type CaptureFetchContext, type CaptureFetchOptions, DEFAULT_REDACTION_RULES, DEFAULT_TRACE_ANALYST_BUDGETS, type DatasetOverview, type ErrorCluster, type EventFilter, type EventKind, type ExportableSpan, type ExtractUsageFromSseOptions, type ExtractedUsage, FAILURE_CLASSES, type FailureClass, FileSystemRawProviderSink, type FileSystemRawProviderSinkOptions, FileSystemTraceStore, type FileSystemTraceStoreOptions, type FlattenOtlpOptions, type GenericSpan, INPUT_VALUE, InMemoryRawProviderSink, type InMemoryRawProviderSinkOptions, InMemoryTraceStore, type JudgeSpan, LLM_CACHED_TOKENS, LLM_CACHED_TOKEN_ATTR_KEYS, LLM_CACHE_WRITE_TOKENS, LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, LLM_COST_ATTR_KEYS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_MODEL_ATTR_KEYS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_OUTPUT_TOKEN_ATTR_KEYS, LLM_REASONING_TOKENS, LLM_REASONING_TOKEN_ATTR_KEYS, type LlmSpan, type Message, NoopRawProviderSink, OPENINFERENCE_SPAN_KIND, OTEL_AGENT_EVAL_SCOPE, OUTPUT_VALUE, type OtelExportConfig, type OtelExporter, type OtlpExport, OtlpFileTraceStore, type OtlpFileTraceStoreOptions, type OtlpFlatLine, type OtlpResourceSpans, type OtlpSpan, type OtlpToRunRecordsOptions, type OtlpTraceRunRecord, type ProjectedOtlpSpan, type ProviderRedactor, type QueryTracesPage, REDACTION_VERSION, RUN_COST_ATTR_KEYS, type RawProviderDirection, type RawProviderEvent, type RawProviderSink, type RawProviderSinkFilter, type RedactionReport, type RedactionRule, ReplayCache, type ReplayCacheEntry, ReplayCacheMissError, type ReplayCacheStats, type ReplayFetchOptions, type RetrievalSpan, type Run, type RunCompleteHook, type RunCompleteHookContext, type RunFilter, RunIntegrityError, type RunIntegrityExpectations, type RunIntegrityIssue, type RunIntegrityIssueCode, type RunIntegrityReport, type RunLayer, type RunOutcome$1 as RunOutcome, type RunStatus, SPAN_KIND_ATTR_KEYS, type SandboxSpan, type SearchSpanResult, type SearchTraceResult, type Span, type SpanBase, type SpanFilter, type SpanHandle, type SpanKind, type SpanMatchRecord, SpanNotFoundError, type SpanStatus, type SseUsageMode, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME, TOOL_NAME_ATTR_KEYS, TRACE_ANALYST_ACTOR_DESCRIPTION, TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, TRACE_ANALYST_SUBAGENT_DESCRIPTION, TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, TRACE_SCHEMA_VERSION, type ToolSpan, type ToolSpanOtlpInput, type TraceAggregate, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystFilters, type TraceAnalystHookOptions, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, TraceEmitter, type TraceEmitterOptions, type TraceEvent, TraceFileMissingError, type TraceInsightContext, type TraceInsightFinding, type TraceInsightPanelRole, type TraceInsightPromptInput, type TraceInsightQualityGate, type TraceInsightQuestion, type TraceInsightReadiness, type TraceInsightSuite, type TraceInsightTask, TraceNotFoundError, type TraceStore, type TraceStoreSource, type TraceStoreToOtlpOptions, type TracesToOtlpResult, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, aggregateLlm, analyzeTraces, applyToolSpanOtlpAttributes, argHash, asNumber, asString, assertRunCaptured, buildTraceAnalystTools, buildTraceInsightContext, buildTraceInsightPrompt, captureFetchToRawSink, convertTraceStoresToOtlp, createOtelExporter, createOtelTracingStore, createReplayFetch, defaultProviderRedactor, defaultTraceInsightPanel, describeTraceInsightScope, domainEvidencePattern, exportRunAsOtlp, extractOtlpAttributes, extractUsage, extractUsageFromResponse, extractUsageFromSse, firstNumberAttr, firstStringAttr, flattenOtlpExportToNdjson, groupBy, hasCapturedToolArgs, inferDomainKeywords, inferOtlpKind, isJudgeSpan, isLlmSpan, isRetrievalSpan, isSandboxSpan, isToolSpan, iterateRawCalls, judgeSpans, llmSpanFromProvider, llmSpans, otelRunCompleteHook, otlpRowsToRunRecords, otlpRowsToTraceRunRecords, otlpToRunRecords, otlpToTraceRunRecords, planTraceInsightQuestions, projectOtlpFlatLine, providerFromBaseUrl, readOtlpStatus, redactString, redactValue, runFailureClass, runsForScenario, scoreTraceInsightReadiness, stringField, throwIfRunIncomplete, tokenizeDomainWords, toolSpans, traceAnalystFunctionGroup, traceAnalystOnRunComplete, traceSpanKindToOpenInferenceKind };
2329
+ export { type AnalyzeTracesInput, type AnalyzeTracesOptions, type AnalyzeTracesResult, type AnalyzeTracesTurnSnapshot, type Artifact, type BudgetLedgerEntry, type BudgetSpec, type CaptureFetchContext, type CaptureFetchOptions, DEFAULT_REDACTION_RULES, DEFAULT_TRACE_ANALYST_BUDGETS, type DatasetOverview, type ErrorCluster, type EventFilter, type EventKind, type ExportableSpan, type ExtractUsageFromSseOptions, type ExtractedUsage, FAILURE_CLASSES, type FailureClass, FileSystemRawProviderSink, type FileSystemRawProviderSinkOptions, FileSystemTraceStore, type FileSystemTraceStoreOptions, type FlattenOtlpOptions, type GenericSpan, INPUT_VALUE, InMemoryRawProviderSink, type InMemoryRawProviderSinkOptions, InMemoryTraceStore, type JudgeSpan, LLM_CACHED_TOKENS, LLM_CACHED_TOKEN_ATTR_KEYS, LLM_CACHE_WRITE_TOKENS, LLM_CACHE_WRITE_TOKEN_ATTR_KEYS, LLM_CONTEXT_TOKENS, LLM_COST_ATTR_KEYS, LLM_COST_USD, LLM_INPUT_TOKENS, LLM_INPUT_TOKEN_ATTR_KEYS, LLM_MODEL_ATTR_KEYS, LLM_MODEL_NAME, LLM_OUTPUT_TOKENS, LLM_OUTPUT_TOKEN_ATTR_KEYS, LLM_REASONING_TOKENS, LLM_REASONING_TOKEN_ATTR_KEYS, type LlmSpan, type LlmSpanOtlpInput, type Message, NoopRawProviderSink, OPENINFERENCE_SPAN_KIND, OTEL_AGENT_EVAL_SCOPE, OUTPUT_VALUE, type OtelExportConfig, type OtelExporter, type OtlpExport, OtlpFileTraceStore, type OtlpFileTraceStoreOptions, type OtlpFlatLine, type OtlpResourceSpans, type OtlpSpan, type OtlpToRunRecordsOptions, type OtlpTraceRunRecord, type ProjectedOtlpSpan, type ProviderRedactor, type QueryTracesPage, REDACTION_VERSION, RUN_COST_ATTR_KEYS, type RawProviderDirection, type RawProviderEvent, type RawProviderSink, type RawProviderSinkFilter, type RedactionReport, type RedactionRule, ReplayCache, type ReplayCacheEntry, ReplayCacheMissError, type ReplayCacheStats, type ReplayFetchOptions, type RetrievalSpan, type Run, type RunCompleteHook, type RunCompleteHookContext, type RunFilter, RunIntegrityError, type RunIntegrityExpectations, type RunIntegrityIssue, type RunIntegrityIssueCode, type RunIntegrityReport, type RunLayer, type RunOutcome$1 as RunOutcome, type RunStatus, SPAN_KIND_ATTR_KEYS, type SandboxSpan, type SearchSpanResult, type SearchTraceResult, type Span, type SpanBase, type SpanFilter, type SpanHandle, type SpanKind, type SpanMatchRecord, SpanNotFoundError, type SpanStatus, type SseUsageMode, TOOL_ARGS_CAPTURED, TOOL_LATENCY_MS, TOOL_NAME, TOOL_NAME_ATTR_KEYS, TRACE_ANALYST_ACTOR_DESCRIPTION, TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION, TRACE_ANALYST_SUBAGENT_DESCRIPTION, TRACE_ANALYST_TRUNCATION_MARKER_PREFIX, TRACE_SCHEMA_VERSION, type ToolSpan, type ToolSpanOtlpInput, type TraceAggregate, type TraceAnalysisStore, type TraceAnalystByteBudgets, type TraceAnalystFilters, type TraceAnalystHookOptions, type TraceAnalystSpan, type TraceAnalystSpanKind, type TraceAnalystSpanStatus, type TraceAnalystTraceSummary, TraceEmitter, type TraceEmitterOptions, type TraceEvent, TraceFileMissingError, type TraceInsightContext, type TraceInsightFinding, type TraceInsightPanelRole, type TraceInsightPromptInput, type TraceInsightQualityGate, type TraceInsightQuestion, type TraceInsightReadiness, type TraceInsightSuite, type TraceInsightTask, TraceNotFoundError, type TraceStore, type TraceStoreSource, type TraceStoreToOtlpOptions, type TracesToOtlpResult, type ViewSpansResult, type ViewTraceOversized, type ViewTraceResult, aggregateLlm, analyzeTraces, applyLlmSpanOtlpAttributes, applyToolSpanOtlpAttributes, argHash, asNumber, asString, assertRunCaptured, buildTraceAnalystTools, buildTraceInsightContext, buildTraceInsightPrompt, captureFetchToRawSink, contextInputTokens, convertTraceStoresToOtlp, createOtelExporter, createOtelTracingStore, createReplayFetch, defaultProviderRedactor, defaultTraceInsightPanel, describeTraceInsightScope, domainEvidencePattern, exportRunAsOtlp, extractOtlpAttributes, extractUsage, extractUsageFromResponse, extractUsageFromSse, firstNumberAttr, firstStringAttr, flattenOtlpExportToNdjson, groupBy, hasCapturedToolArgs, inferDomainKeywords, inferOtlpKind, isJudgeSpan, isLlmSpan, isRetrievalSpan, isSandboxSpan, isToolSpan, iterateRawCalls, judgeSpans, llmSpanFromProvider, llmSpans, otelRunCompleteHook, otlpRowsToRunRecords, otlpRowsToTraceRunRecords, otlpToRunRecords, otlpToTraceRunRecords, planTraceInsightQuestions, projectOtlpFlatLine, providerFromBaseUrl, readOtlpStatus, redactString, redactValue, runFailureClass, runsForScenario, scoreTraceInsightReadiness, stringField, throwIfRunIncomplete, tokenizeDomainWords, toolSpans, traceAnalystFunctionGroup, traceAnalystOnRunComplete, traceSpanKindToOpenInferenceKind };
package/dist/traces.js CHANGED
@@ -27,8 +27,8 @@ import {
27
27
  scoreTraceInsightReadiness,
28
28
  tokenizeDomainWords,
29
29
  traceAnalystOnRunComplete
30
- } from "./chunk-FTUMG2U7.js";
31
- import "./chunk-KSDQVPLR.js";
30
+ } from "./chunk-ZYHJNKI3.js";
31
+ import "./chunk-H5UD2323.js";
32
32
  import {
33
33
  extractUsage,
34
34
  extractUsageFromResponse,
@@ -50,7 +50,7 @@ import {
50
50
  TRACE_ANALYST_ACTOR_DESCRIPTION_VERSION,
51
51
  TRACE_ANALYST_SUBAGENT_DESCRIPTION,
52
52
  analyzeTraces
53
- } from "./chunk-3EHHMC6E.js";
53
+ } from "./chunk-FIUFRXP3.js";
54
54
  import {
55
55
  DEFAULT_REDACTION_RULES,
56
56
  REDACTION_VERSION,
@@ -59,27 +59,15 @@ import {
59
59
  } from "./chunk-GGE4NNQT.js";
60
60
  import {
61
61
  DEFAULT_TRACE_ANALYST_BUDGETS,
62
- LLM_CACHED_TOKEN_ATTR_KEYS,
63
- LLM_CACHE_WRITE_TOKEN_ATTR_KEYS,
64
- LLM_COST_ATTR_KEYS,
65
- LLM_INPUT_TOKEN_ATTR_KEYS,
66
- LLM_MODEL_ATTR_KEYS,
67
- LLM_OUTPUT_TOKEN_ATTR_KEYS,
68
- LLM_REASONING_TOKEN_ATTR_KEYS,
69
62
  OtlpFileTraceStore,
70
- RUN_COST_ATTR_KEYS,
71
- SPAN_KIND_ATTR_KEYS,
72
63
  SpanNotFoundError,
73
- TOOL_NAME_ATTR_KEYS,
74
64
  TRACE_ANALYST_TRUNCATION_MARKER_PREFIX,
75
65
  TraceFileMissingError,
76
66
  TraceNotFoundError,
77
67
  applyToolSpanOtlpAttributes,
78
- asNumber,
79
68
  asString,
80
69
  buildTraceAnalystTools,
81
70
  extractOtlpAttributes,
82
- firstNumberAttr,
83
71
  firstStringAttr,
84
72
  inferOtlpKind,
85
73
  projectOtlpFlatLine,
@@ -87,7 +75,7 @@ import {
87
75
  stringField,
88
76
  traceAnalystFunctionGroup,
89
77
  traceSpanKindToOpenInferenceKind
90
- } from "./chunk-QKEGNI5B.js";
78
+ } from "./chunk-6QIM2EAP.js";
91
79
  import {
92
80
  RunIntegrityError,
93
81
  assertRunCaptured,
@@ -120,18 +108,33 @@ import "./chunk-ONWEPEDO.js";
120
108
  import {
121
109
  INPUT_VALUE,
122
110
  LLM_CACHED_TOKENS,
111
+ LLM_CACHED_TOKEN_ATTR_KEYS,
123
112
  LLM_CACHE_WRITE_TOKENS,
113
+ LLM_CACHE_WRITE_TOKEN_ATTR_KEYS,
114
+ LLM_CONTEXT_TOKENS,
115
+ LLM_COST_ATTR_KEYS,
124
116
  LLM_COST_USD,
125
117
  LLM_INPUT_TOKENS,
118
+ LLM_INPUT_TOKEN_ATTR_KEYS,
119
+ LLM_MODEL_ATTR_KEYS,
126
120
  LLM_MODEL_NAME,
127
121
  LLM_OUTPUT_TOKENS,
122
+ LLM_OUTPUT_TOKEN_ATTR_KEYS,
128
123
  LLM_REASONING_TOKENS,
124
+ LLM_REASONING_TOKEN_ATTR_KEYS,
129
125
  OPENINFERENCE_SPAN_KIND,
130
126
  OUTPUT_VALUE,
127
+ RUN_COST_ATTR_KEYS,
128
+ SPAN_KIND_ATTR_KEYS,
131
129
  TOOL_ARGS_CAPTURED,
132
130
  TOOL_LATENCY_MS,
133
- TOOL_NAME
134
- } from "./chunk-WDHBCA3M.js";
131
+ TOOL_NAME,
132
+ TOOL_NAME_ATTR_KEYS,
133
+ applyLlmSpanOtlpAttributes,
134
+ asNumber,
135
+ contextInputTokens,
136
+ firstNumberAttr
137
+ } from "./chunk-K4DBDHLK.js";
135
138
  import "./chunk-PZ5AY32C.js";
136
139
  export {
137
140
  DEFAULT_REDACTION_RULES,
@@ -146,6 +149,7 @@ export {
146
149
  LLM_CACHED_TOKEN_ATTR_KEYS,
147
150
  LLM_CACHE_WRITE_TOKENS,
148
151
  LLM_CACHE_WRITE_TOKEN_ATTR_KEYS,
152
+ LLM_CONTEXT_TOKENS,
149
153
  LLM_COST_ATTR_KEYS,
150
154
  LLM_COST_USD,
151
155
  LLM_INPUT_TOKENS,
@@ -182,6 +186,7 @@ export {
182
186
  TraceNotFoundError,
183
187
  aggregateLlm,
184
188
  analyzeTraces,
189
+ applyLlmSpanOtlpAttributes,
185
190
  applyToolSpanOtlpAttributes,
186
191
  argHash,
187
192
  asNumber,
@@ -191,6 +196,7 @@ export {
191
196
  buildTraceInsightContext,
192
197
  buildTraceInsightPrompt,
193
198
  captureFetchToRawSink,
199
+ contextInputTokens,
194
200
  convertTraceStoresToOtlp,
195
201
  createOtelExporter,
196
202
  createOtelTracingStore,
@@ -146,6 +146,13 @@ declare class CostLedger {
146
146
  private ensureCostLimitPersisted;
147
147
  private appendEvent;
148
148
  }
149
+ /** Public callback surface for a shared cost ledger.
150
+ *
151
+ * Declaration bundles may expose this type through multiple package subpaths.
152
+ * Keeping callback contracts structural lets those subpaths compose while the
153
+ * concrete {@link CostLedger} retains its private durable state.
154
+ */
155
+ type CostLedgerHandle = Pick<CostLedger, keyof CostLedger>;
149
156
 
150
157
  type RunStatus = 'running' | 'completed' | 'failed' | 'aborted';
151
158
  interface BudgetSpec {
@@ -1088,7 +1095,7 @@ declare class WireError extends Error {
1088
1095
  constructor(code: string, message: string, status?: number, details?: unknown | undefined);
1089
1096
  }
1090
1097
  interface HandleJudgeOptions {
1091
- costLedger?: CostLedger;
1098
+ costLedger?: CostLedgerHandle;
1092
1099
  costPhase?: string;
1093
1100
  llm?: LlmClientOptions;
1094
1101
  signal?: AbortSignal;
@@ -34,9 +34,9 @@ import {
34
34
  runRpcOnce,
35
35
  startServer,
36
36
  startServerAsync
37
- } from "../chunk-LTVG32KX.js";
37
+ } from "../chunk-JTMFT5QZ.js";
38
38
  import "../chunk-NJC7U437.js";
39
- import "../chunk-VCTY3W6J.js";
39
+ import "../chunk-MLHRFWQK.js";
40
40
  import "../chunk-VI2UW6B6.js";
41
41
  import "../chunk-PC4UYEBM.js";
42
42
  import "../chunk-ONWEPEDO.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tangle-network/agent-eval",
3
- "version": "0.118.1",
3
+ "version": "0.118.3",
4
4
  "description": "Evaluate and improve AI agents from runs, traces, judges, and feedback. Compare candidates, cluster failures, measure lift, and gate releases.",
5
5
  "homepage": "https://github.com/tangle-network/agent-eval#readme",
6
6
  "repository": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/analyst/chat-client.ts","../src/trace-analyst/behavioral-metrics.ts","../src/analyst/behavioral-analyst.ts","../src/analyst/default-registry.ts"],"sourcesContent":["/**\n * ChatClient — the single LLM abstraction analysts call.\n *\n * agent-eval already ships an `LlmClient` (OpenAI-compatible, retry,\n * graceful JSON-schema degrade) and judges that talk to `TCloud`. Two\n * mixed patterns force every analyst author to pick a transport, which\n * couples analyst code to runtime concerns (cli-bridge vs router vs\n * sandbox-sdk) it shouldn't know about.\n *\n * `ChatClient` is one interface every analyst takes via `AnalystContext.chat`.\n * The operator decides at the registry boundary which transport binds\n * to it. Analyst code stays transport-agnostic; swapping production\n * (sandbox-sdk) for local dev (cli-bridge) or tests (mock) is a one-\n * line factory call.\n *\n * Designed to coexist: existing `LlmClient` callers and existing\n * `TCloud`-based judges keep working untouched. New analyst code uses\n * `ChatClient`. When old call sites migrate, they pick up budgeting,\n * cancellation, and unified telemetry for free.\n */\n\nimport {\n type LlmCallRequest,\n type LlmCallResult,\n LlmClient,\n type LlmClientOptions,\n} from '../llm-client'\n\n/**\n * Unified chat interface. Mirrors LlmCallRequest/Result so the OpenAI-\n * compatible mental model stays. Two methods: a one-shot `chat()` and\n * an `streamChat()` for future agentic loops (not yet exposed).\n */\nexport interface ChatClient {\n /** Display name of the bound transport — included in telemetry. */\n readonly transport: ChatTransport\n /** Default model when caller omits — operators bind this per environment. */\n readonly defaultModel?: string\n /** Total provider attempts this transport can make for one chat call. */\n readonly maximumAttempts?: number\n\n /** Implementations must enforce `req.maxTokens` when it is present. */\n chat(req: ChatRequest, opts?: ChatCallOpts): Promise<ChatResponse>\n}\n\nexport type ChatTransport =\n | 'router' // router.tangle.tools — production paid models\n | 'sandbox-sdk' // box.streamPrompt() — chat completion via sandbox SDK\n | 'cli-bridge' // local cli-bridge for dev / local-only runs\n | 'direct-provider' // direct OpenAI / Anthropic / etc. — bypass router\n | 'mock' // test-time injection\n\nexport interface ChatRequest extends Omit<LlmCallRequest, 'model'> {\n /** Optional — falls back to ChatClient.defaultModel. */\n model?: string\n}\n\nexport type ChatResponse = LlmCallResult\n\nexport interface ChatCallOpts {\n /** Cancel the in-flight request. */\n signal?: AbortSignal\n /** Hard USD ceiling for this single call (informational; the underlying transport may not enforce). */\n maxCostUsd?: number\n /** Correlation tag carried into request headers when the transport allows. */\n correlationId?: string\n /** Stable provider idempotency key for retries/redrives of one paid call. */\n idempotencyKey?: string\n}\n\n// ── Factory ─────────────────────────────────────────────────────────\n\nexport type CreateChatClientOpts =\n | RouterTransportOpts\n | CliBridgeTransportOpts\n | DirectProviderTransportOpts\n | SandboxSdkTransportOpts\n | MockTransportOpts\n\ninterface BaseTransportOpts {\n defaultModel?: string\n /** Total provider attempts. Required for opaque transports used in capped runs. */\n maximumAttempts?: number\n}\n\nexport interface RouterTransportOpts extends BaseTransportOpts {\n transport: 'router'\n baseUrl?: string\n apiKey: string\n}\n\nexport interface CliBridgeTransportOpts extends BaseTransportOpts {\n transport: 'cli-bridge'\n baseUrl?: string\n bearer?: string\n}\n\nexport interface DirectProviderTransportOpts extends BaseTransportOpts {\n transport: 'direct-provider'\n baseUrl: string\n apiKey: string\n}\n\n/**\n * Sandbox-SDK transport. Provided as a thin pass-through: the caller\n * supplies a callable that mimics LlmClient.chat() against an already-\n * configured Sandbox handle. We don't import the SDK here to keep\n * agent-eval dep-free of @tangle-network/sandbox.\n */\nexport interface SandboxSdkTransportOpts extends BaseTransportOpts {\n transport: 'sandbox-sdk'\n chat: (req: ChatRequest, opts?: ChatCallOpts) => Promise<ChatResponse>\n}\n\n/**\n * Mock transport for tests. The handler receives the request and returns\n * whatever the test wants. No retries, no JSON-schema degrade.\n */\nexport interface MockTransportOpts extends BaseTransportOpts {\n transport: 'mock'\n handler: (req: ChatRequest, opts?: ChatCallOpts) => Promise<ChatResponse>\n}\n\n/**\n * Build a ChatClient bound to a specific transport. The returned client\n * is safe to share across analysts in a single registry run.\n */\nexport function createChatClient(opts: CreateChatClientOpts): ChatClient {\n switch (opts.transport) {\n case 'router':\n return wrapLlmClient(\n opts.transport,\n opts.defaultModel,\n new LlmClient({\n baseUrl: opts.baseUrl ?? 'https://router.tangle.tools/v1',\n apiKey: opts.apiKey,\n maxRetries: opts.maximumAttempts,\n } as LlmClientOptions),\n )\n case 'cli-bridge':\n return wrapLlmClient(\n opts.transport,\n opts.defaultModel,\n new LlmClient({\n baseUrl: opts.baseUrl ?? 'http://127.0.0.1:3344/v1',\n apiKey: opts.bearer ?? '',\n maxRetries: opts.maximumAttempts,\n } as LlmClientOptions),\n )\n case 'direct-provider':\n return wrapLlmClient(\n opts.transport,\n opts.defaultModel,\n new LlmClient({\n baseUrl: opts.baseUrl,\n apiKey: opts.apiKey,\n maxRetries: opts.maximumAttempts,\n } as LlmClientOptions),\n )\n case 'sandbox-sdk':\n return {\n transport: 'sandbox-sdk',\n defaultModel: opts.defaultModel,\n maximumAttempts: opts.maximumAttempts,\n chat: async (req, callOpts) => opts.chat(resolveModel(req, opts.defaultModel), callOpts),\n }\n case 'mock':\n return {\n transport: 'mock',\n defaultModel: opts.defaultModel,\n maximumAttempts: 1,\n chat: async (req, callOpts) => opts.handler(resolveModel(req, opts.defaultModel), callOpts),\n }\n }\n}\n\nfunction wrapLlmClient(\n transport: ChatTransport,\n defaultModel: string | undefined,\n inner: LlmClient,\n): ChatClient {\n return {\n transport,\n defaultModel,\n maximumAttempts: inner.maximumAttempts,\n chat: (req, callOpts) => {\n const resolved = resolveModel(req, defaultModel)\n const request: LlmCallRequest = {\n model: resolved.model!,\n messages: req.messages,\n jsonMode: req.jsonMode,\n jsonSchema: req.jsonSchema,\n temperature: req.temperature,\n maxTokens: req.maxTokens,\n timeoutMs: req.timeoutMs,\n }\n return inner.call(request, {\n signal: callOpts?.signal,\n idempotencyKey: callOpts?.idempotencyKey,\n })\n },\n }\n}\n\nfunction resolveModel(req: ChatRequest, defaultModel: string | undefined): ChatRequest {\n if (req.model) return req\n if (!defaultModel) {\n throw new Error(\n 'ChatClient.chat: no model on request and no defaultModel on the client. ' +\n 'Either pass req.model or bind defaultModel at createChatClient().',\n )\n }\n return { ...req, model: defaultModel }\n}\n","/**\n * Deterministic behavioral metrics over OTLP spans — pure arithmetic, no LLM.\n *\n * These are the model-independent multiplier: the four trace-quality signals a\n * tolerant analyzer (e.g. HALO) re-derives per run inside the model — token\n * growth, output decay, tool monoculture, missing self-verification — computed\n * here once, in TypeScript, with zero model judgment. A finding that falls out\n * of arithmetic is trivially model-agnostic and cannot hallucinate the trend.\n *\n * General, not trace-specific: the detectors key off token trajectories and\n * tool usage present in any agentic OTLP trace, not any one benchmark.\n */\n\nimport { executionTrackByLane } from '../trace/execution-tracks'\nimport {\n LLM_INPUT_TOKEN_ATTR_KEYS,\n LLM_OUTPUT_TOKEN_ATTR_KEYS,\n TOOL_NAME_ATTR_KEYS,\n} from '../trace/otlp-attributes'\nimport { spanEpochMillis } from './otlp-span'\nimport type { TraceAnalystSpan } from './types'\n\nexport type SuboptimalCode =\n | 'monotonic-input-growth'\n | 'output-length-decay'\n | 'single-tool-dependency'\n | 'no-self-verification'\n\nexport interface SuboptimalSignal {\n code: SuboptimalCode\n severity: 'high' | 'medium' | 'low'\n /** Human-readable claim, with the backing numbers inlined. */\n detail: string\n /** The exact figures the detector fired on — auditable, no model in the loop. */\n evidence: Record<string, number | string | boolean>\n}\n\nexport interface BehavioralMetrics {\n /** The only trace represented by these metrics; null when spans are empty. */\n traceId: string | null\n llmCallCount: number\n /** Causally serial LLM timelines. Parallel branches are never joined. */\n tokenSequences: BehavioralTokenSequence[]\n /** Token values from the longest serial timeline, retained for convenience. */\n inputTokenTrajectory: number[]\n outputTokenTrajectory: number[]\n toolHistogram: Record<string, number>\n totalToolCalls: number\n distinctTools: number\n /** distinct/total tool calls; 1.0 when there are no tool calls. */\n toolDiversityRatio: number\n hasSelfVerification: boolean\n signals: SuboptimalSignal[]\n}\n\nexport interface BehavioralTokenSequence {\n scopeId: string\n spanIds: string[]\n inputTokenTrajectory: Array<number | null>\n outputTokenTrajectory: Array<number | null>\n}\n\ninterface TokenSample {\n span: TraceAnalystSpan\n input: number | null\n output: number | null\n step: number | null\n}\n\n/** ≥ this input-token growth ratio across a run, with no compression, fires. */\nconst INPUT_GROWTH_FACTOR = 3\n/** Tool-usage signals need at least this many calls to be meaningful. */\nconst MIN_TOOL_CALLS = 3\n/** Tool names that read or check state count as self-verification, not mutation.\n * Covers the inspect verbs plus the read/search tools real harnesses use to\n * verify (Claude Code Read/Grep/Glob, codex read_file/ls/cat, git status/diff,\n * test/lint). A pure shell tool (Bash/exec_command) is intentionally NOT matched\n * — its name can't tell a `pytest` from an `rm`. */\nconst VERIFY_RE =\n /verif|eval|inspect|check|assert|validat|review|confirm|read|grep|glob|search|view|\\blist\\b|\\bls\\b|\\bcat\\b|\\bfind\\b|diff|status|\\btest|lint|typecheck/i\n\nfunction num(v: unknown): number | null {\n return typeof v === 'number' && Number.isFinite(v) ? v : null\n}\nfunction numAttr(attrs: Record<string, unknown>, keys: readonly string[]): number | null {\n for (const key of keys) {\n const value = num(attrs[key])\n if (value !== null) return value\n }\n return null\n}\nfunction inputTokensOf(s: TraceAnalystSpan): number | null {\n return (\n numAttr(s.attributes, LLM_INPUT_TOKEN_ATTR_KEYS) ?? num(s.attributes['llm.usage.input_tokens'])\n )\n}\nfunction outputTokensOf(s: TraceAnalystSpan): number | null {\n return (\n numAttr(s.attributes, LLM_OUTPUT_TOKEN_ATTR_KEYS) ??\n num(s.attributes['llm.usage.output_tokens'])\n )\n}\nfunction stepOf(s: TraceAnalystSpan): number | null {\n return num(s.attributes.step)\n}\nfunction toolNameOf(s: TraceAnalystSpan): string | null {\n if (s.tool_name) return s.tool_name\n for (const key of TOOL_NAME_ATTR_KEYS) {\n const t = s.attributes[key]\n if (typeof t === 'string' && t.length > 0) return t\n }\n return null\n}\n\n/**\n * Reduce a span list to behavioral metrics + fired suboptimality signals.\n * Pure + deterministic: same spans → same output, on any machine, no model.\n */\nexport function computeTraceMetrics(spans: readonly TraceAnalystSpan[]): BehavioralMetrics {\n const traceIds = new Set(spans.map((span) => span.trace_id))\n if (traceIds.size > 1) {\n throw new Error(\n `computeTraceMetrics: expected spans from one trace, received ${traceIds.size} traces`,\n )\n }\n const traceId = traceIds.values().next().value ?? null\n\n const samples: TokenSample[] = spans.map((span) => ({\n span,\n input: inputTokensOf(span),\n output: outputTokensOf(span),\n step: stepOf(span),\n }))\n const llmSamples = samples.filter((sample) => sample.span.kind === 'LLM')\n const tokenSamples =\n llmSamples.length > 0\n ? llmSamples\n : samples.filter((sample) => sample.input !== null || sample.output !== null)\n const tokenSequences = buildTokenSequences(tokenSamples, spans)\n const primarySequence = tokenSequences[0]\n const inputTokenTrajectory =\n primarySequence?.inputTokenTrajectory.filter((value): value is number => value !== null) ?? []\n const outputTokenTrajectory =\n primarySequence?.outputTokenTrajectory.filter((value): value is number => value !== null) ?? []\n const toolHistogram: Record<string, number> = {}\n let hasSelfVerification = false\n\n for (const s of spans) {\n const tool = toolNameOf(s)\n if (tool) {\n toolHistogram[tool] = (toolHistogram[tool] ?? 0) + 1\n if (VERIFY_RE.test(tool)) hasSelfVerification = true\n }\n }\n\n const totalToolCalls = Object.values(toolHistogram).reduce((a, b) => a + b, 0)\n const distinctTools = Object.keys(toolHistogram).length\n const toolDiversityRatio = totalToolCalls === 0 ? 1 : distinctTools / totalToolCalls\n\n const signals: SuboptimalSignal[] = []\n const seenTokenSignals = new Set<SuboptimalCode>()\n for (const sequence of tokenSequences) {\n for (const signal of tokenSignals(sequence)) {\n if (seenTokenSignals.has(signal.code)) continue\n seenTokenSignals.add(signal.code)\n signals.push(signal)\n }\n }\n\n if (totalToolCalls >= MIN_TOOL_CALLS && distinctTools === 1) {\n const only = Object.keys(toolHistogram)[0]!\n signals.push({\n code: 'single-tool-dependency',\n severity: 'medium',\n detail: `All ${totalToolCalls} observed tool calls are \\`${only}\\`; no alternate tool call was observed.`,\n evidence: { tool: only, calls: totalToolCalls, distinct_tools: 1 },\n })\n }\n\n if (totalToolCalls >= MIN_TOOL_CALLS && !hasSelfVerification) {\n signals.push({\n code: 'no-self-verification',\n severity: 'medium',\n detail: `${totalToolCalls} tool calls were observed without a verification-named tool call.`,\n evidence: { tool_calls: totalToolCalls, verification_calls: 0 },\n })\n }\n\n return {\n traceId,\n llmCallCount: tokenSamples.length,\n tokenSequences,\n inputTokenTrajectory,\n outputTokenTrajectory,\n toolHistogram,\n totalToolCalls,\n distinctTools,\n toolDiversityRatio,\n hasSelfVerification,\n signals,\n }\n}\n\nfunction buildTokenSequences(\n samples: readonly TokenSample[],\n spans: readonly TraceAnalystSpan[],\n): BehavioralTokenSequence[] {\n const spansById = new Map(spans.map((span) => [span.span_id, span]))\n const executionScopeFor = createTokenExecutionScopeResolver(spansById)\n const scopedSamples = samples.map((sample) => ({\n sample,\n ...executionScopeFor(sample.span),\n }))\n const trackByLane = executionTrackByLane(scopedSamples)\n const byTrack = new Map<string, { scopeId: string; samples: TokenSample[] }>()\n for (const scoped of scopedSamples) {\n const trackId = trackByLane.get(scoped.key)!\n const track = byTrack.get(trackId) ?? { scopeId: scoped.scopeId, samples: [] }\n track.samples.push(scoped.sample)\n byTrack.set(trackId, track)\n }\n\n const sequences: BehavioralTokenSequence[] = []\n for (const { scopeId, samples: tracked } of byTrack.values()) {\n const runs = serialTokenRuns([...tracked].sort(compareTokenSamples))\n runs.forEach((run, index) => {\n sequences.push({\n scopeId: runs.length === 1 ? scopeId : `${scopeId}#${index + 1}`,\n spanIds: run.map((sample) => sample.span.span_id),\n inputTokenTrajectory: run.map((sample) => sample.input),\n outputTokenTrajectory: run.map((sample) => sample.output),\n })\n })\n }\n\n return sequences.sort(\n (a, b) =>\n b.spanIds.length - a.spanIds.length ||\n a.scopeId.localeCompare(b.scopeId) ||\n a.spanIds[0]!.localeCompare(b.spanIds[0]!),\n )\n}\n\ninterface AncestorScope {\n agentId: string | null\n rootId: string | null\n missingParentId: string | null\n laneSpanId: string | null\n}\n\nfunction createTokenExecutionScopeResolver(spansById: ReadonlyMap<string, TraceAnalystSpan>): (\n span: TraceAnalystSpan,\n) => {\n key: string\n scopeKey: string\n scopeId: string\n start: number | null\n end: number | null\n} {\n const cache = new Map<string, AncestorScope>()\n return (span) => {\n const ancestry = resolveAncestorScope(span.parent_span_id, spansById, cache)\n const rootId = ancestry.rootId\n const scopeId = ancestry.agentId\n ? `span:${ancestry.agentId}`\n : ancestry.missingParentId\n ? `parent:${ancestry.missingParentId}`\n : rootId\n ? `root:${rootId}`\n : span.agent_name\n ? `agent:${span.agent_name}`\n : `trace:${span.trace_id}`\n const scopeSpanId = ancestry.agentId ?? ancestry.missingParentId ?? rootId\n const laneSpan = ancestry.laneSpanId ? spansById.get(ancestry.laneSpanId) : undefined\n const direct = scopeSpanId === null || ancestry.laneSpanId === scopeSpanId\n const timedSpan = direct ? span : laneSpan\n return {\n key: JSON.stringify([scopeId, direct ? span.span_id : ancestry.laneSpanId]),\n scopeKey: scopeId,\n scopeId,\n start: timedSpan ? spanEpochMillis(timedSpan.start_time) : null,\n end: timedSpan ? spanEpochMillis(timedSpan.end_time) : null,\n }\n }\n}\n\nfunction resolveAncestorScope(\n startId: string | null,\n spansById: ReadonlyMap<string, TraceAnalystSpan>,\n cache: Map<string, AncestorScope>,\n): AncestorScope {\n const empty: AncestorScope = {\n agentId: null,\n rootId: null,\n missingParentId: null,\n laneSpanId: null,\n }\n if (!startId) return empty\n\n const path: string[] = []\n const pathIndex = new Map<string, number>()\n let currentId: string | null = startId\n let resolved = empty\n while (currentId) {\n const cached = cache.get(currentId)\n if (cached) {\n resolved = cached\n break\n }\n const cycleStart = pathIndex.get(currentId)\n if (cycleStart !== undefined) {\n resolved = {\n agentId: null,\n rootId: [...path.slice(cycleStart)].sort()[0]!,\n missingParentId: null,\n laneSpanId: [...path.slice(cycleStart)].sort()[0]!,\n }\n break\n }\n const current = spansById.get(currentId)\n if (!current) {\n resolved = {\n agentId: null,\n rootId: null,\n missingParentId: currentId,\n laneSpanId: currentId,\n }\n break\n }\n if (current.kind === 'AGENT') {\n resolved = {\n agentId: current.span_id,\n rootId: null,\n missingParentId: null,\n laneSpanId: current.span_id,\n }\n break\n }\n pathIndex.set(currentId, path.length)\n path.push(currentId)\n currentId = current.parent_span_id\n }\n\n for (let index = path.length - 1; index >= 0; index -= 1) {\n if (resolved.agentId === null && resolved.rootId === null) {\n resolved = { ...resolved, rootId: path[index]!, laneSpanId: path[index]! }\n } else if (\n resolved.laneSpanId === (resolved.agentId ?? resolved.missingParentId ?? resolved.rootId)\n ) {\n resolved = { ...resolved, laneSpanId: path[index]! }\n }\n cache.set(path[index]!, resolved)\n }\n return resolved\n}\n\nfunction compareTokenSamples(a: TokenSample, b: TokenSample): number {\n const aStart = spanEpochMillis(a.span.start_time)\n const bStart = spanEpochMillis(b.span.start_time)\n if (aStart === null && bStart !== null) return 1\n if (aStart !== null && bStart === null) return -1\n if (aStart !== null && bStart !== null && aStart !== bStart) return aStart - bStart\n if (a.step !== null && b.step !== null && a.step !== b.step) return a.step - b.step\n return a.span.span_id.localeCompare(b.span.span_id)\n}\n\nfunction serialTokenRuns(ordered: readonly TokenSample[]): TokenSample[][] {\n const runs: TokenSample[][] = []\n let serial: TokenSample[] = []\n let overlap: TokenSample[] = []\n let overlapEnd = Number.NEGATIVE_INFINITY\n\n const flushSerial = () => {\n if (serial.length > 0) runs.push(serial)\n serial = []\n }\n const flushOverlap = () => {\n if (overlap.length === 1) {\n serial.push(overlap[0]!)\n } else if (overlap.length > 1) {\n flushSerial()\n for (const sample of overlap) runs.push([sample])\n }\n overlap = []\n overlapEnd = Number.NEGATIVE_INFINITY\n }\n\n for (const sample of ordered) {\n const start = spanEpochMillis(sample.span.start_time)\n const end = spanEpochMillis(sample.span.end_time)\n if (start === null || end === null || sample.span.duration_ms <= 0 || end < start) {\n flushOverlap()\n flushSerial()\n runs.push([sample])\n continue\n }\n if (overlap.length > 0 && start >= overlapEnd) flushOverlap()\n overlap.push(sample)\n overlapEnd = Math.max(overlapEnd, end)\n }\n flushOverlap()\n flushSerial()\n return runs\n}\n\nfunction tokenSignals(sequence: BehavioralTokenSequence): SuboptimalSignal[] {\n const signals: SuboptimalSignal[] = []\n const inputs = sequence.inputTokenTrajectory\n const outputs = sequence.outputTokenTrajectory\n if (inputs.length >= 3 && inputs.every((value): value is number => value !== null)) {\n const first = inputs[0]!\n const last = inputs[inputs.length - 1]!\n const isMonotonic = everyAdjacent(inputs, (previous, current) => current >= previous)\n const growthFromZero = first === 0 && last > 0\n const growth = growthFromZero ? Infinity : first > 0 ? last / first : 0\n if (isMonotonic && last > first && growth >= INPUT_GROWTH_FACTOR) {\n const growthLabel = growthFromZero ? '0→nonzero (unbounded)' : `${growth.toFixed(1)}x`\n signals.push({\n code: 'monotonic-input-growth',\n severity: 'high',\n detail: `LLM input tokens grew ${growthLabel} (${first}→${last}) across ${inputs.length} serial calls without an intervening decrease.`,\n evidence: {\n first,\n last,\n growth_x: growthFromZero ? 'unbounded' : Number(growth.toFixed(2)),\n calls: inputs.length,\n scope: sequence.scopeId,\n first_span_id: sequence.spanIds[0]!,\n last_span_id: sequence.spanIds[sequence.spanIds.length - 1]!,\n },\n })\n }\n }\n\n if (\n inputs.length >= 3 &&\n inputs.length === outputs.length &&\n inputs.every((value): value is number => value !== null) &&\n outputs.every((value): value is number => value !== null)\n ) {\n const first = outputs[0]!\n const last = outputs[outputs.length - 1]!\n const inputIsMonotonic = everyAdjacent(inputs, (previous, current) => current >= previous)\n const outputIsMonotonic = everyAdjacent(outputs, (previous, current) => current <= previous)\n const inputGrew = inputs[inputs.length - 1]! > inputs[0]!\n if (inputIsMonotonic && inputGrew && outputIsMonotonic && last < first) {\n signals.push({\n code: 'output-length-decay',\n severity: 'medium',\n detail: `LLM output tokens shrank ${first}→${last} over ${outputs.length} serial calls while input tokens increased monotonically.`,\n evidence: {\n first,\n last,\n calls: outputs.length,\n scope: sequence.scopeId,\n first_span_id: sequence.spanIds[0]!,\n last_span_id: sequence.spanIds[sequence.spanIds.length - 1]!,\n },\n })\n }\n }\n return signals\n}\n\nfunction everyAdjacent(\n values: readonly number[],\n predicate: (previous: number, current: number) => boolean,\n): boolean {\n return values.slice(1).every((current, index) => predicate(values[index]!, current))\n}\n","/**\n * `behavioralAnalyst` — a DETERMINISTIC analyst (cost.kind = 'deterministic',\n * never calls the LLM). It produces the efficiency/behavioral findings a\n * tolerant agentic analyzer (HALO) re-derives per run inside the model —\n * context bloat, output decay, tool monoculture, missing self-verification —\n * directly from arithmetic over spans (`computeTraceMetrics`).\n *\n * Why it matters: these findings are model-agnostic BY CONSTRUCTION (no model\n * in the loop), so they cannot return 0 on a weak model the way the Ax-RLM\n * does — and they are strictly more reliable than HALO, which spends tokens\n * re-deriving the same numbers and can hallucinate the trend. The agentic\n * RLM kinds remain for SEMANTIC findings that genuinely need a model; this\n * analyst owns the behavioral class.\n */\n\nimport {\n type BehavioralMetrics,\n computeTraceMetrics,\n type SuboptimalCode,\n} from '../trace-analyst/behavioral-metrics'\nimport type { TraceAnalysisStore } from '../trace-analyst/store'\nimport { type Analyst, type AnalystFinding, makeFinding } from './types'\n\nconst RECOMMENDED_ACTION: Record<SuboptimalCode, string> = {\n 'monotonic-input-growth':\n 'Inspect context assembly; if prior history is repeatedly included, summarize completed work before the next model call.',\n 'output-length-decay':\n 'Check late-step completeness; if shorter responses omit required work, add explicit completion criteria to the agent instructions.',\n 'single-tool-dependency':\n 'Test whether an inspect or verification tool improves outcomes after the repeated call fails or returns no progress.',\n 'no-self-verification':\n 'After state-changing actions, require an observable check before the agent proceeds.',\n}\n\nconst ANALYST_ID = 'efficiency-behavioral'\n\nconst AGGREGATE_CLAIM: Record<SuboptimalCode, (observed: number, analyzed: number) => string> = {\n 'monotonic-input-growth': (observed, analyzed) =>\n `${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.`,\n 'output-length-decay': (observed, analyzed) =>\n `${observed}/${analyzed} analyzed traces showed output tokens decrease while input tokens increased monotonically across at least 3 serial model calls.`,\n 'single-tool-dependency': (observed, analyzed) =>\n `${observed}/${analyzed} analyzed traces used only one named tool across at least 3 tool calls.`,\n 'no-self-verification': (observed, analyzed) =>\n `${observed}/${analyzed} analyzed traces had at least 3 tool calls without a verification-named tool call.`,\n}\n\n/**\n * Map computed signals → structured AnalystFindings. Pure: no LLM, no clock\n * dependence beyond `produced_at` (overridable for deterministic tests).\n */\nexport function deriveEfficiencyFindings(\n metrics: BehavioralMetrics,\n opts: { analystId?: string; producedAt?: string } = {},\n): AnalystFinding[] {\n const analystId = opts.analystId ?? ANALYST_ID\n const traceId = metrics.traceId\n return metrics.signals.map((sig) =>\n makeFinding({\n analyst_id: analystId,\n area: 'efficiency',\n subject: sig.code,\n claim: sig.detail,\n severity: sig.severity,\n // Deterministic arithmetic over spans, not a model judgment → certain.\n confidence: 1,\n evidence_refs: [\n {\n kind: 'metric',\n uri: traceId\n ? `metric://trace/${encodeURIComponent(traceId)}/efficiency/${sig.code}`\n : `metric://efficiency/${sig.code}`,\n excerpt: JSON.stringify(sig.evidence),\n },\n ],\n recommended_action: RECOMMENDED_ACTION[sig.code],\n metadata: {\n deterministic: true,\n evidence: sig.evidence,\n ...(traceId ? { trace_id: traceId } : {}),\n },\n id_basis: sig.code,\n ...(opts.producedAt ? { produced_at: opts.producedAt } : {}),\n }),\n )\n}\n\n/** The deterministic behavioral/efficiency analyst (no LLM, any-model). */\nexport function behavioralAnalyst(): Analyst<TraceAnalysisStore> {\n return {\n id: ANALYST_ID,\n description:\n 'Deterministic behavioral/efficiency findings over OTLP spans — token-growth, output-decay, tool-monoculture, missing self-verification. Zero LLM; model-agnostic by construction.',\n inputKind: 'trace-store',\n cost: { kind: 'deterministic' },\n version: '2.0.0',\n async analyze(store) {\n const overview = await store.getOverview()\n const analyzedTraceIds = [...new Set(overview.sample_trace_ids)].sort()\n const findingsById = new Map<\n string,\n { finding: AnalystFinding; traceIds: string[]; evidence: AnalystFinding['evidence_refs'] }\n >()\n for (const traceId of analyzedTraceIds) {\n const viewed = await store.viewTrace({ trace_id: traceId })\n if (viewed.trace_id !== traceId) {\n throw new Error(\n `behavioralAnalyst: requested trace '${traceId}', received '${viewed.trace_id}'`,\n )\n }\n if (!viewed.spans) {\n throw new Error(\n `behavioralAnalyst: trace '${traceId}' is oversized; complete spans are required`,\n )\n }\n const metrics = computeTraceMetrics(viewed.spans)\n if (metrics.traceId !== null && metrics.traceId !== traceId) {\n throw new Error(\n `behavioralAnalyst: requested trace '${traceId}', received '${metrics.traceId}'`,\n )\n }\n for (const finding of deriveEfficiencyFindings(metrics)) {\n const current = findingsById.get(finding.finding_id)\n if (!current) {\n findingsById.set(finding.finding_id, {\n finding,\n traceIds: [traceId],\n evidence: [...finding.evidence_refs],\n })\n continue\n }\n current.traceIds.push(traceId)\n current.evidence.push(...finding.evidence_refs)\n }\n }\n return [...findingsById.values()].map(({ finding, traceIds, evidence }) => ({\n ...finding,\n claim: AGGREGATE_CLAIM[finding.subject as SuboptimalCode](\n traceIds.length,\n analyzedTraceIds.length,\n ),\n rationale: `${traceIds.length}/${analyzedTraceIds.length} analyzed traces exhibited this pattern.`,\n evidence_refs: evidence,\n metadata: {\n deterministic: true,\n trace_ids: traceIds,\n observed_trace_count: traceIds.length,\n analyzed_trace_count: analyzedTraceIds.length,\n },\n }))\n },\n }\n}\n","/**\n * `buildDefaultAnalystRegistry` — the canonical analyst suite, so consumers\n * stop hand-wiring `new AnalystRegistry()` + per-kind `createTraceAnalystKind`.\n *\n * The deterministic `behavioralAnalyst` is ALWAYS registered (it needs no\n * model and is model-agnostic by construction). The agentic RLM kinds are\n * registered only when an `ai` service is supplied — so a caller with no LLM\n * still gets the full behavioral/efficiency diagnosis, and the substrate's\n * \"any model (including no model)\" guarantee holds at the suite level.\n */\n\nimport type { AxAIService } from '@ax-llm/ax'\nimport { behavioralAnalyst } from './behavioral-analyst'\nimport { createTraceAnalystKind, type TraceAnalystKindSpec } from './kind-factory'\nimport { DEFAULT_TRACE_ANALYST_KINDS } from './kinds'\nimport { AnalystRegistry, type AnalystRegistryOptions } from './registry'\n\nexport interface DefaultAnalystRegistryOptions {\n /** Ax service for the agentic RLM kinds. Omit → only the deterministic analyst. */\n ai?: AxAIService\n /** Model for the agentic kinds (falls back to the ai service default). */\n model?: string\n /** Which agentic kinds to register when `ai` is present. Default = the shipped suite. */\n kinds?: readonly TraceAnalystKindSpec[]\n /** Set false to omit the deterministic behavioral analyst (default: include). */\n includeBehavioral?: boolean\n /** Forwarded to the AnalystRegistry constructor (signal, tags, priorFindings). */\n registry?: AnalystRegistryOptions\n}\n\nexport function buildDefaultAnalystRegistry(\n opts: DefaultAnalystRegistryOptions = {},\n): AnalystRegistry {\n const registry = new AnalystRegistry(opts.registry)\n if (opts.includeBehavioral !== false) {\n registry.register(behavioralAnalyst())\n }\n if (opts.ai) {\n const kinds = opts.kinds ?? DEFAULT_TRACE_ANALYST_KINDS\n for (const spec of kinds) {\n registry.register(createTraceAnalystKind(spec, { ai: opts.ai, model: opts.model }))\n }\n }\n return registry\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA+HO,SAAS,iBAAiB,MAAwC;AACvE,UAAQ,KAAK,WAAW;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,IAAI,UAAU;AAAA,UACZ,SAAS,KAAK,WAAW;AAAA,UACzB,QAAQ,KAAK;AAAA,UACb,YAAY,KAAK;AAAA,QACnB,CAAqB;AAAA,MACvB;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,IAAI,UAAU;AAAA,UACZ,SAAS,KAAK,WAAW;AAAA,UACzB,QAAQ,KAAK,UAAU;AAAA,UACvB,YAAY,KAAK;AAAA,QACnB,CAAqB;AAAA,MACvB;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,KAAK;AAAA,QACL,KAAK;AAAA,QACL,IAAI,UAAU;AAAA,UACZ,SAAS,KAAK;AAAA,UACd,QAAQ,KAAK;AAAA,UACb,YAAY,KAAK;AAAA,QACnB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